C++ and Garbage Collection

By Mike Spertus

Dr. Dobb's Journal December 1997

if(word > heapBottom && word < heapTop){	/* In heap? */
   desc = blockDescriptors[word >> 12];	/* Get descriptor */
   desc->marked = 1;                 	/* Mark the block */
   if(desc->kind == SMALL_OBJECT_PAGE)	/* small object array? */
       desc->markbits[(word - desc->objBase)/desc->objsize] = 1;
}                                     	/* Mark individual item */

Example 2: Selecting the appropriate mark bit.

Back to Article


Copyright © 1997, Dr. Dobb's Journal