On 12 Dec 2013, at 16:15, Jonas Maebe wrote:
On 12 Dec 2013, at 16:05, Adriaan van Os wrote:
Is it safe to assume that manually allocating a cleared memory
block (e.g. with calloc rather than New) sufficiently initializes
the ansistrings and dynamic arrays in that memory block ? If not,
what does the init code look like that New is calling/setting up
for ansistrings and dynamic arrays ?
In practice, that is currently enough.
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).
Jonas
_______________________________________________
fpc-devel maillist - [email protected]
http://lists.freepascal.org/mailman/listinfo/fpc-devel