[fpc-pascal] Sharing dynamic arrays between threads
Jonas Maebe
jonas.maebe at elis.ugent.be
Fri Feb 25 14:05:54 CET 2011
On 25 Feb 2011, at 14:02, Wimpie Nortje wrote:
> Initially I only disposed the record. This lead to lots of memory
> leaks.
> Then I set dynarray:= nil before disposing the record. Less mem leaks,
> but still a lot.
> Then I started to finalize the dynamic array before disposing the
> record. A huge improvement but still some leaks.
>
> I get the feeling the arrays are sometimes not free'd but I don't
> understand why.
Calling dispose() on a record with a dynamic array field will free the
array (and recursively finalize all its elements) as long as the
pointer on which you call it is correctly typed in the source code.
The fact that you still get memory leaks after everything you are
doing suggests that something else is wrong in your program.
Jonas
More information about the fpc-pascal
mailing list