« GC update | Main | Movement »

June 25, 2005

No more GC loops

I fixed the cycles in the sweep phase. I had a few bugs in my changes where the mark table (what I'm calling the hashtable that holds the list of marked node addresses) wasn't getting updated properly, so certain nodes were being continually marked in a runaway loop.

It was interesting to fix, since I couldn't tickle the problem with simple test scripts. I had to use the miniruby build calls used when compiling ruby from source. Debugging was difficult as well, since the cycle didn't occur immediately and it was hard to tell how much work had been done when cycles occurred. So, I added extensive logging statements to watch all the state changes and see what addresses were being marked in what order. I then wrote a small script to parse the GC debug logs and find the cycle nodes. It ended up working pretty well!

I still have some bugs to fix on the sweep phase, but the mark phase is looking relatively complete.

I've also got to put together a few small slides for the seattle.rb meeting on Tuesday night, since I'm giving a progress report on the GC fixes. I'm not sure if I will have the fixes working by Tuesday, but at least I'll be able to explain the design and implementation of the changes.

As an aside, it's been a while since I wrote bare C, so this project has been fun to work on. I don't miss C's tedious memory management when I'm working in Java, but there are times where I miss the terseness and flexibility of pointers, and being able to tightly control and keep track of allocated memory. Don't worry though, it doesn't take a lot of C to make me want to start doing Java and Ruby code again. It's just that having lots of constraints and steps can be oddly liberating sometimes.

Posted by djb at June 25, 2005 11:54 PM

Comments

Post a comment




Remember Me?

(you may use HTML tags for style)