Calendar

April 2017
Mo Tu We Th Fr Sa Su
<< >>
12
3456789
10111213141516
17181920212223
24252627282930

Langs

GC Light

Posted on Jan 21 2005

As I needed a small GC for GBA programming I wrote it, it was pretty funny. I used a mark & sweep classical and simple algorithm. The most difficult part was about data structures. Free blocks are kept in a linked list called "free list" and usually the GC allocate theses lists using malloc() , but since the GC Light is operating on a fixed size memory (the 256Ko of external GBA memory), mallocated and GC'ed memory overlaps ! One easy way would have been to keep a fixed percentage of the memory available for storing data structures but then you're wasting too much space when memory is not fragmented or having not enough space to store a lot of very small fragmented free blocks, making the GC crash ! The best is to have the GC data structures interleaved with GC'ed allocated memory : after some tweaking it works pretty well, now I have to run the MotionScript VM with this new GC to check that nothing is broken (I need to remove some malloc's in the VM) and after let's check some fibonacci perfs on the real hardware !

0 comment
Name : Email : Website : Message :