[jhc] the new GC, anyone got a bitset?

Florian Weimer fw at deneb.enyo.de
Fri Jun 4 15:51:53 EDT 2010

* John Meacham:

> There is just one thing that is bothering me, I still rely on libJudy in
> the runtime for its extremely fast bitset operation. Basically, in order
> to determine if an address is allocated on the heap vs on the stack or
> in the bss or data segments, I use a bitmap, adding an entry for each 4M
> chunk of memory dedicated to heap pages. on a 64 bit system, using a
> plain bit array is just not feasable, libJudy has a very fast bitset
> that I utilize, but it is not exactly lightweight and is LGPL which may
> cause issues for creating statically linked executables from jhc.

You could use mmap with PROT_NONE to get a large chunk of contiguous
address space, and allocate the parts you actually use with mprotect,
setting PROT_READ and PROT_WRITE.  Then it's far easier to tell which
addresses are part of the heap and which aren't.

More information about the jhc mailing list