[fpc-pascal] ppcjvm issues

Dmitry Boyarintsev skalogryz.lists at gmail.com
Fri Jan 27 22:18:17 CET 2017


On Fri, Jan 27, 2017 at 1:41 PM, Jonas Maebe <jonas at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20170127/fac3a349/attachment.html>


More information about the fpc-pascal mailing list