i'm trying to figure out the best numbers to use for setting up a sorted collection... i'm just not understanding the numbers i'm getting from the heapdump unit at the end of the run...

i have two collections (/details at the end/)... these collections can be pretty "large" (~40000 entries for one collection, ~20000 for the other)... using the *exact same data* in both cases, if i use this code to set them up...

  aTLEColl    := New(PTLEColl, Init(16384,64));
  aSatCatColl := New(PSCColl, Init(16384,64));

i get numbers like this (from the heapdump)

  Heap dump by heaptrc unit
  8205341 memory blocks allocated : 333112907/357222392
  8205341 memory blocks freed     : 333112907/357222392
  0 unfreed memory blocks : 0
  True heap size : 720896 (208 used in System startup)
  True free heap : 720688

but if i use this code to set up the collections...

  aTLEColl    := New(PTLEColl, Init(1,1));
  aSatCatColl := New(PSCColl, Init(1,1));

i get numbers like this (from the heapdump)

  Heap dump by heaptrc unit
  8260386 memory blocks allocated : 3874244611/3898464904
  8260386 memory blocks freed     : 3874244611/3898464904
  0 unfreed memory blocks : 0
  True heap size : 262144 (208 used in System startup)
  True free heap : 261936

*if i'm reading this properly*, what is confusing me is the first one allocates less memory blocks and uses more heap whereas the second one allocates (a lot) more memory blocks (55000 more??) but uses much less heap...

so i'm trying to figure out the best set of init numbers for the collections... i'm wanting the fastest run time with the smallest memory usage... am i understanding this correctly??



*collection details if needed*

  PSCColl    = ^TSCColl;
  TSCColl    = object(TSortedCollection)
                 Function Compare(Key1,Key2:Pointer):sw_integer; virtual;
                 Function KeyOf(Item:Pointer):Pointer; virtual;
                 Procedure Insert (Item:Pointer); virtual;
               end;
  PTLEColl   = ^TTLEColl;
  TTLEColl   = object(TSortedCollection)
                 Function Compare(Key1,Key2:Pointer):sw_integer; virtual;
                 Function KeyOf(Item:Pointer):Pointer; virtual;
                 Procedure Insert (Item:Pointer); virtual;
               end;

PSCColl contains these...

  PSCRec     = ^TSCRec;
  TSCRec     = object(TObject)
                 catnbr   : Tcat_nbr;
                 satname  : Tsat_name;
                 inorbit  : boolean;
                 constructor Init(cnbr,sname:string; iorbit:boolean);
                 destructor Done; virtual;
               end;

PTLEColl contains these...

  PTLERec    = ^TTLERec;
  TTLERec    = object(TObject)
                 satname  : Tsat_name;
                 satdata1 : Tline_data;
                 satdata2 : Tline_data;
                 catnbr   : Tcat_nbr;
                 epoch    : double;
                 constructor Init(sname,sdata1,sdata2,cnbr:string; 
edate:double);
                 destructor Done; virtual;
               end;


they hold these data types...

  Tcat_nbr   = pstring;   // 5 characters
  Tsat_name  = pstring;   // 24 characters
  Tline_data = pstring;   // 69 characters

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to