TM Research Journal

Thursday, March 30, 2006

Garbage Collection in Solaris cc

Since our target environment is Solaris, I thought I should use Solari's libgc which deals with garbage collection for c.

http://developers.sun.com/prodtech/cc/articles/libgc.html

I had a hard time geting it to work, was following the instructions and adding -lgc as a compiler flag. Finally, after a lot of blood, sweat and tears, it runs out that I should add the flag AFTER the source file! Go figure!

e.g. cc testmem.c -lgc -o testmem

http://docs.sun.com/source/819-3688/cc_ops.app.html

Eventually I got it working. It is doing garbage collection and all. The only thing which I need to ascertain whether it is thread-safe or not. If it's not, then I'm back to square one. I posted a question on Sun's forums and am waiting for an answer.

http://forum.sun.com/thread.jspa?threadID=29907

RSTM Paper

Had a quick look at the RSTM paper. Need to go through it again. What I noticed is that they do say that freeing memory that's not being used anymore is a hassle. Which is a problem I discovered the hard way.

Fixing the Memory Leaks

I haven't worked on fixing the memory leaks (for the reasons mentioned my previous post). But I would like to note that adding a reference counter to the user data (or objects) most probably will neccessitate adding one more level of indirection, which will generate more cache misses thus making performance even worse.

That was an argument in favour of using a garbage collector (or an argument in favour of me being lazy and not wanting to fix the leak :) )

0 Comments:

Post a Comment

<< Home