[fpc-pascal] How to free this memory and avoid memory leak

Graeme Geldenhuys graemeg.lists at gmail.com
Thu Oct 8 16:40:16 CEST 2009


2009/10/8 Jonas Maebe <jonas.maebe at elis.ugent.be>:
>
> Also with understanding how dynamic arrays and/or move work. Dynamic arrays
> are reference counted pointers to data blobs. sizeof(dynamic_array_var) =
> sizeof(pointer), always, and regardless of the length of the array. It's
> like sizeof(class) = sizeof(ansistring) = sizeof(pointer). Move() takes
> "var" parameters as first and second parameters, which means that it will
> read data from the memory *occupied by* the first argument (rather than
> memory it may point at) and store data into the memory *occupied by* the
> second argument (idem).


Thanks for that explanation, it makes a lot more sense now.  I also
didn't know this:
   sizeof(dynamic_array_var) = sizeof(pointer)

I wouldn't be making that mistake soon.  I better get my "annotation"
support fully working in the new INF help viewer, so I can add my own
notes to the Language Reference docs. :)

>> Heaptrc
>> keeps telling me there is a memory leak.
>
> It is correct.

I never doubted heaptrc.   :)


-- 
Regards,
  - Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/



More information about the fpc-pascal mailing list