Forum Discussion

Jeschke's avatar
Jeschke
New Contributor
14 years ago

Does AQtime show too much live objects when using dynamical array in D7?



I initialised some dynamical arrays and deinitialized them again and agian.

with setlength in Delphi 7.

Memory usage  (I think this is "live size" in the result page under classes data ) increases unbelievably.

No difference if  I make a snapshot or when I close applicatoion.



When I press button1 in The application for initializing 2 dyn arrays of double with 1Mio *8 bytes each and unrelease again , there an extra of 49k live

remaining.



When I press Button 3 (repeatedly  setlength( random size) and release by setlength(0)  Aqtime finds some 100MB of live space, but taskmanager of Windows XP shows only memoryusage of 3...18MB ending up after finish at 3MB.



What do IO do wrong?





procedure TForm1.Button1Click(Sender: TObject);

var r1,r0:array of double;

begin

  setlength(r0,1000000);

  setlength(r1,1000000);

  setlength(r0,0);

  setlength(r1,0);

end;



procedure TForm1.Button3Click(Sender: TObject);

var r:array[0..3] of array of double;i,j:integer;

begin

  for j:=0 to 100000 do begin

    for i:=0 to 3 do

      setlength(r,random(1000000));

    for i:=0 to 3 do

      setlength(r,random(0));

    if j mod 1000=0 then begin

      if j mod 2000=0 then caption:='/'

                      else caption:='|'

      application.ProcessMessages;

    end;

  end;

  for i:=0 to 3 do

    setlength(r,random(0));

  caption:='fertig';

end;

  • Hello Klaus,



    I suggest that you clear the profiling results before clicking the buttons in your application and check the procedures' memory usage.







  • Jeschke's avatar
    Jeschke
    New Contributor
    Hi

    thank you for this hint.  The results list looks far more easy to read.



    But still when I press button1 (to innitialise 2 dynamical arrays of each 8 MB lengths and release them) I have one single reserved virtual memory object live with length od 49k. This is after leaving the application ( 23:12:50 in results file)



    When I do this same automated after pressing Button3 5000 times there are 105MB live lleft in 1633 reserved virtual memory objects.

    ( 23:27:26 in results file).



    Still I|m wondering, because the Task Manager does not show some 100 MB of Memorz usage. Whats wrong_


  • aqAnt's avatar
    aqAnt
    SmartBear Alumni (Retired)

    Hello Klaus,





    It looks like your archive does not contain files with exact allocation results. We tried to replicate the situation here, but we did not get the results you mentioned.