[fpc-devel] Manual memory management with ansistrings and dynamic arrays

Adriaan van Os fpc at microbizz.nl
Thu Dec 12 16:39:09 CET 2013


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 ?

Regards,

Adriaan van Os




More information about the fpc-devel mailing list