12.25.2010

Garbage Collection

I not a fan of garbage collection for systems designed to reach high performance, but in certain moments it's quite useful. During my intense experiences with linked lists, I created a concept for lists that base on a specific kind of client/server system for pointer/object relations. It enables the programme to create server objects that automatically set all of their associated pointers to zero when it gets deleted. In the way it manages it's associated pointers, it can also detect when there are no more objects pointing at it. And that's the point where I thought that it'd make an interesting system for a more clean garbage collection. Some thoughts later I ended up with an interesting concept integratable into standard C++. That's cool, cause I make it as flexible as my RTTI system: You decide when to collect and when not. You could even create multiple garbage collectors and they won't do something until you say them. The cool thing is that this system is self-managed and on-demand: it doesn't break interrupt the program looking for deletable references. Instead, it always knows what to delete due to the object's self-managed garbage marking. It has it's memory overhead, though. Especially for the pointers used for such a collector: they would be three times as big as a normal one. But well, if you have always local pointer variables, this shouldn't be a problem. It's rather costly when assigning new objects, but efficient when deleting them. As every other management system, is has special balance of performance, overhead and feature set. This will also be an integral part of ITK. It's cool that you can use C++ to extend it's own possibilities, almost totally independent from the underlying system. As long as you don't use "evil" C casts. and other things breaking the newly subsystem.

So yeah, this would increase my GC tolerance a bit more, since it' has a rather nice performance equal to a double-linked list. I like linked lists. They do so well on modern systems. And they make fine structures for dynamic, unpredictable data (my specialization).

No comments: