On Thursday, 30 October 2014 at 07:13:09 UTC, Jacob Carlborg
wrote:
On 2014-10-29 22:51, Christian Schneider wrote:
Btw, fixed the example, thanks for giving me the right clues.
Of course,
it was just the manual memory management à la Objective-C that
was
missing! I am really lucky that I spent already days, maybe
weeks
debugging retain / release / autorelease on many projects, so
for me
this will be peanuts! I just had a little flashback. I love
ARC and am
looking forward for D to feature it as well, but for now,
manual memory
management is really not the thing that will put me off.
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.
Slightly derailing the conversation, but I see this all the
time...
Isn't the situation actually this:
GC allocated objects are not guaranteed to be de-allocated before
program termination.
If a GC allocated object is deallocated, its destructor *is*
guaranteed to be called.
Except:
Destructors are not called for arrays of objects, whether they
are structs or emplaced classes, even when they are de-allocated.