Re: [fpc-pascal] Sharing dynamic arrays between threads

2011-02-25 Thread Wimpie Nortje
> 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 tha

Re: [fpc-pascal] Sharing dynamic arrays between threads

2011-02-25 Thread Jonas Maebe
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 impr

Re: [fpc-pascal] Sharing dynamic arrays between threads

2011-02-25 Thread Wimpie Nortje
Thanks for the resonse Jonas >> Is it safe to create a dynamic array with setlength() in one thread and >> free the array using finalize() in another thread? > > Normally, you should not call finalize() on dynamic arrays. When the > last reference to a dynamic array goes out of scope, it is finalis

Re: [fpc-pascal] Sharing dynamic arrays between threads

2011-02-25 Thread Jonas Maebe
On 25 Feb 2011, at 13:28, Wimpie Nortje wrote: Is it safe to create a dynamic array with setlength() in one thread and free the array using finalize() in another thread? Normally, you should not call finalize() on dynamic arrays. When the last reference to a dynamic array goes out of scop

[fpc-pascal] Sharing dynamic arrays between threads

2011-02-25 Thread Wimpie Nortje
Hi, Is it safe to create a dynamic array with setlength() in one thread and free the array using finalize() in another thread? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal