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


Jonas
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to