5 ms·
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 es
by orangeduck 10y ago
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.
- Ded7xSEoPKYNsDd 10y agoInteresting. Your link says in the portability section > All it relies on is the assumption that the architecture uses a call stack to implement function frames. Does this mean it will treat live objects as dead when the only reference is stored in a register?
- orangeduck 10y agoThe registers are flushed to the stack before the mark is performed (using `setjmp`) so unless the behaviour of the platform is particularly odd in this case it shouldn't be an issue.
- srean 10y agoVery 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 10y agoYeah 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 10y agoCool stuff, thanks for the elaboration.