#171887 - keldon - Thu Dec 31, 2009 2:52 pm
Download source code
Edit: I somehow uploaded the wrong demo file (a fix has been submitted)
Hi, I wrote an incremental GC routine 18 months ago; I lost the documentation somehow and would like some help writing new documentation as well as creating an article on how to code garbage collection algorithms.
Code purpose
This can be used to add incremental garbage collection to your own scripting languages, or integrated into code for any structures that would be better handled by such a system.
Demo code
I had some really nice demonstration code that used the GC system to build a number of structures and delete them in incremental steps, but that is unfortunately lost too. I will code them back in at some point, but for now the code is there. Edit: I've uploaded one of the tests here, but this was written before the update so may not be compatible with the more recent code. I'll check this all tomorrow.
Download source code
- Demo code (needs integration)
In short it allows incremental garbage collection by using set partitions and locking mechanisms. The state of a reference is frozen at certain states in the GC in such a way that the GC can be stopped at any time without any complex traversing of the structures.
I haven't looked into it much, but I suspect a generational GC can be created from most of it's logic (or at least structural concept).
I've also included a few basic structures:
- list.cpp - list of objects
- integer.cpp - stores an integer
- fixed_map.cpp - maps 'x' keys
- map.cpp - maps keys to
- var.cpp - flexible variable object
- object.cpp - base class
Unfinished structures:
- fixed_list.cpp
---
I have uploaded it in this unfinished state for the following reasons:
- to make me accountable to following it up; making things public is good, it's far too easy to stop work on something nobody knows about
- get the ball rolling
- even without the documentation, I haven't seen any code on the net like this so it should be helpful
---
Other notes
Root handles aren't deleted by the garbage collector, neither are any objects that are owned by the root. These are the important handles!
Edit: Oh dear, I nearly deleted this post with Ctrl+W ... saved by Chrome ... phew =)
Last edited by keldon on Fri Jan 01, 2010 8:48 pm; edited 1 time in total
Edit: I somehow uploaded the wrong demo file (a fix has been submitted)
Hi, I wrote an incremental GC routine 18 months ago; I lost the documentation somehow and would like some help writing new documentation as well as creating an article on how to code garbage collection algorithms.
Code purpose
This can be used to add incremental garbage collection to your own scripting languages, or integrated into code for any structures that would be better handled by such a system.
Demo code
I had some really nice demonstration code that used the GC system to build a number of structures and delete them in incremental steps, but that is unfortunately lost too. I will code them back in at some point, but for now the code is there. Edit: I've uploaded one of the tests here, but this was written before the update so may not be compatible with the more recent code. I'll check this all tomorrow.
Download source code
- Demo code (needs integration)
In short it allows incremental garbage collection by using set partitions and locking mechanisms. The state of a reference is frozen at certain states in the GC in such a way that the GC can be stopped at any time without any complex traversing of the structures.
I haven't looked into it much, but I suspect a generational GC can be created from most of it's logic (or at least structural concept).
I've also included a few basic structures:
- list.cpp - list of objects
- integer.cpp - stores an integer
- fixed_map.cpp - maps 'x' keys
- map.cpp - maps keys to
- var.cpp - flexible variable object
- object.cpp - base class
Unfinished structures:
- fixed_list.cpp
---
I have uploaded it in this unfinished state for the following reasons:
- to make me accountable to following it up; making things public is good, it's far too easy to stop work on something nobody knows about
- get the ball rolling
- even without the documentation, I haven't seen any code on the net like this so it should be helpful
---
Other notes
Root handles aren't deleted by the garbage collector, neither are any objects that are owned by the root. These are the important handles!
Edit: Oh dear, I nearly deleted this post with Ctrl+W ... saved by Chrome ... phew =)
Last edited by keldon on Fri Jan 01, 2010 8:48 pm; edited 1 time in total