You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @BenGoldberg1 , That is a great idea! You could even just use a u8 and keep the mark bit the same size. That would save us from needing to reset the the mark bits each time we are done sweeping. I am in the process of rewriting the garbage collector to be a generational copying version, so this is definitely something I will keep in mind.
This suggestion uses a little extra memory to save a little bit of time.
Change the type of mark from a boolean to an integer, and add an integer gc_count which keeps track of how many times garbage collection has happened.
When marking objects as being accessible, assign the value of gc_count to the 'mark' of every reachable object.
Objects whose mark is not equal to gc_count can be freed.
For objects being kept, the mark can be left as is.
If you come across an object whose mark is not gc_cur or gc_cur-1, panic.
If you think corruption is inconceivable, leave mark as a bool, but on alternate GCs, cycle between assigning true and false to it
The text was updated successfully, but these errors were encountered: