[fpc-pascal] ppcjvm issues

Jonas Maebe jonas at freepascal.org
Fri Jan 27 19:41:14 CET 2017

On 27/01/17 19:37, Dmitry Boyarintsev wrote:
> Object Pascal semantic of calling .Free suggests that "o" would no
> longer be a valid object.
> If a dummy Free method is available for JVM, then such semantic is violated.

Calling Free is not defined as "any further access to this object must 
now crash or return invalid data". 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 

> 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.


More information about the fpc-pascal mailing list