[fpc-pascal] ppcjvm issues
Lars
noreply at z505.com
Sun Jan 29 10:00:26 CET 2017
On Fri, January 27, 2017 10:52 am, Jon Foster wrote:
>
> On 01/27/2017 06:36 AM, Dmitry Boyarintsev wrote:
>
>> On Tue, Jan 10, 2017 at 6:14 AM, Michael Schnell <mschnell at lumino.de
>> <mailto:mschnell at lumino.de>> wrote:
>>
>>
>>
>> If destroying an object is not necessary, the class should provide a
>> dummy Free procedure. So the application programmer always can/should use
>> Free.
>>
>>
>> Why dummy? if it should be like this
>>
>>
>> procedure TObject.Free; begin if Self<>nil then Self:=nil; end;
>>
>> Destroying object is not necessary, but dereferencing is.
>> If the code keeps the reference to an object, it would not be collected.
>> [...]
>>
> Correct me if I'm wrong: It would seem like that your free implementation
> doesn't actually do anything, other than fulfilling the obligation of
> having a "free".
That's kind of the point, you aren't actually really freeing the object
but emulating something a close as you could get to it... Delphi iOS
release/free fake/dummy system does something similar.
But, it's really confusing, as you have to think about what the hell
consequences all this causes.
For example see:
http://stackoverflow.com/questions/27818697/how-to-free-a-component-in-android-ios
"DisposeOf breaks ARC. It violates golden rule of ARC Any object reference
can be either valid object reference or nil and introduces third state -
disposed "zombie" object reference.
Anyone trying to understand ARC memory management should look at DisposeOf
like addition that just solves Delphi specific framework issues and not
concept that really belongs to ARC itself. "
"Why DisposeOf exists in Delphi ARC compilers?
TComponent class (and all its descendants) was designed with manual memory
management in mind. It uses notification mechanism that is not compatible
with ARC memory management because it relies on breaking strong reference
cycles in destructor. Since TComponent is one of base classes Delphi
frameworks rely upon, it must be able to function properly under ARC
memory management. "
More information about the fpc-pascal
mailing list