[fpc-devel] limited -gc ?

Martin lazarus at mfriebe.de
Sun Oct 9 22:34:03 CEST 2011


-gc, is apparently only useful in very limited scenarios, such as 
applications, that have no interaction with the OS at all, or can 
otherwise gurantee, never to access any memory that was returned by (and 
therefore allocated by) the OS.

An LCL app can not guarantee that...

Yet what I am looking for is a simpler variant, that can help doing the 
same for class-instances, or dyn-array.

For classes there is -CR but it act only when calling methods (any 
method or only virtual methods?), I can for example not tell if 
accessing a property mapped to field would also trigger tests on this.

Every class or dyn array should be in a block of memory allocated by the 
fpc heap mgr (probably even always at the start (or fixed offset) of 
such a block). Therefore I would guess (just guess...) that such a check 
could be done?
It would greatly help finding any access to freed data.

Any comments, any chance for something like that? Or am I overlooking 
it, and it already exists?



More information about the fpc-devel mailing list