GC for noobs
Szymon Gatner
noemail at gmail.com
Thu Feb 27 01:49:07 PST 2014
Hi,
I am evaluating D for future projects and coming from C++ I find
it really hard to understand semantics of destruction of
GC-managed code.
After many application-shutdown crashes caused by invalid order
of class destructor calls I really think I need to change the way
I am thinking about them (and resource management in general I
suppose).
My crashes (still have them and can't track all as debugging D
sucks) are caused by the fact that d-tor of parent object can be
called before child d-tors. Adding destroy() calls in parent
d-tors helped with some of crashes but I really hate this
solution as I was virtually NEVER using 'delete' in C++.
I feel like I should be doing things in D very differently than I
am doing them in C++. I now think I should be using structs
everywhere because I understand them but I do need reference
semantics (ideally with unique ownership).
Please point me to a literature for C++ programmer that has very
little experience with GC/resource management, because at this
point I really feel like GC should be easing things and working
against me.
More information about the Digitalmars-d-learn
mailing list