
Gcpp – Experimental deferred and unordered destruction library for C++ - ingve
https://github.com/hsutter/gcpp
======
orangeduck
For anyone curious, I built a project in C called tgc
([https://github.com/orangeduck/tgc](https://github.com/orangeduck/tgc)) which
has some similarities. It's essentially a stand alone version of the Cello
Garbage Collector ([http://libcello.org/learn/garbage-
collection](http://libcello.org/learn/garbage-collection)) and provides
garbage collection for stack and heap objects allocated via the given
functions.

~~~
srean
Very nice.

GCC introduced split stack in 4.6 I think. Code that uses this split stack
feature would be a problem right ? Anyway to handle those in tgc ?

If I understand it correctly if one rolls ones own spaghetti stack on the heap
tgc would still be fine with it. Is that correct ?

~~~
orangeduck
Yeah split stacks will be a problem. Essentially `tgc` just scans between the
address recorded as the "bottom" and the one recorded as the "top". Both of
theses can be manually adjusted if you have some better idea of these
locations (such as your own spaghetti stack).

~~~
srean
Cool stuff, thanks for the elaboration.

------
theprotocol
Very cool. I'm not skilled enough in C++ to comment on any of the
implementation details, but I have to say this kind of approach is really neat
- sort of an OO-ish encapsulation of memory regions with controllable
granularity, with a logical representation of regions as groups of object
instances.

------
mhogomchungu
This seems to more or less do what Qt's deleteLater()[1] does.

[1]
[http://doc.qt.io/qt-5/qobject.html#deleteLater](http://doc.qt.io/qt-5/qobject.html#deleteLater)

~~~
blub
It doesn't seem so to me.

AFAIK deleteLater and autorelease pools are a way of postponing cleanup until
sometime after execution returns to the message loop.

That's not useable for implementing something like a graph class.

~~~
mhogomchungu
> That's not useable for implementing something like a graph class.

How about Qt's management of QObjects through QObject's parent/child
relationship?[1]

[1]
[http://doc.qt.io/qt-4.8/objecttrees.html](http://doc.qt.io/qt-4.8/objecttrees.html)

~~~
blub
That's perfect for trees :)

