D/Objective-C 64bit
Christian Schneider via Digitalmars-d-announce
digitalmars-d-announce at puremagic.com
Thu Oct 30 08:28:22 PDT 2014
> I had a look at your fix. I see that you added a call to
> "release" in the destructor. Just for the record, there's no
> guarantee that the destructor of a GC allocated object gets
> run, at all.
Omg, how embarrassing ;) of course I need to put it in dealloc so
that it will work with NSMutableArray et al. if I am going
Objective-C memory management, then I should do it the intended
way indeed!
> Or, if this class get instantiated by some Objective-C
> framework then it will know nothing about the destructor in D.
> I guess the right solution is to override "dealloc".
So far, I was not even considering a D library that would be used
through Objective-C code, but yeah, that's a good point as well.
> Hmm, I'm wondering if it's a good idea to lower a destructor to
> "dealloc", just like a constructor is lowered to "init".
We will have to find out, but dealloc definitely is the
destructor in Objc.
More information about the Digitalmars-d-announce
mailing list