On 12 Dec 2013, at 16:39, Adriaan van Os wrote:

Jonas Maebe wrote:

In theory, you should call "initialize" for every record/array containing management types in your allocated block to be safe.
And in practice, you also have to call "finalize" again for every record/array containing managed types (and for every separate managed type too, I forgot to mention this earlier although I hope that was implicitly clear) in that allocated block before freeing it again (to prevent memory leaks).

Thanks for your reply. I feel comfortable calling "initialize" and "finalize" for every managed type in the memory block that I allocate/deallocate manually. However, can you elaborate why "initialize" and "finalize" must be called for the containing record/ array too ? If my understanding of your reply is correct ?

If you call it for an array/record containing managed types, then then compiler/rtl will initialise all managed fields/elements within that array/record. Calling it for individual elements is only required if they're not contained in a record/array.


Jonas
_______________________________________________
fpc-devel maillist  -  [email protected]
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to