On Fri, Jan 27, 2017 at 1:41 PM, Jonas Maebe <jo...@freepascal.org> wrote:
> It is defined as "if the instance is not nil, then it calls the destroy > method, and next it calls FreeInstance". You could override FreeInstance to > not free memory on any platform. > > However, if JVM free method would at least reset "o" reference to nil, >> then the semantic of "o" being an invalid object remains. >> > > There is no need to do this. > > It also suggests to the garbage collector that the memory could be >> recycled earlier, that the variable leaves the scope. >> > > That is true. How about moving "nil"-ing of the reference into default FreeInstance for JVM target? The whole point of removing the reference, is to let the collector to dispose of the object as soon as possible. I'm thinking about classes that consume a lot of (system) resources and release them only in during destruction. Releasing them as soon as possible **might** be a benefit for the code behavior over all. thanks, Dmitry
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal