[kaffe] gc_free vs. KFREE

Dalibor Topic robilad at yahoo.com
Mon Mar 31 08:28:01 PST 2003


Hi Marc,

--- Marc Kleine-Budde <kleine-budde at gmx.de> wrote:
> 
> My assumption is that KFREE clears the mem at once,
> and gc_free marks
> the mem to be freed by the garbage  collector? Am I
> right?

AFAIK, KMALLOC/KFREE should be used for memory that
does not go through the gc, while gc_malloc/gc_free
should be used for the rest. Never mix the calls, or
you'll be in big trouble. KMALLOC/KFREE leave memory
management to the runtime library, while
gc_malloc/gc_free do their own memory management.

see
http://www.kaffe.org/pipermail/kaffe/1998-February/020705.html
http://www.kaffe.org/pipermail/kaffe/2000-May/006576.html

> In which situation should one preference which
> method?

when you're dealing with java objects or data that
might end up within java objects, I think you should
use gc_malloc/gc_free. Otherwise use KMALLOC/KFREE.

Keep in mind, though, that JanosVM developers have
done a lot to improve the GC in their VM, and that has
lead them to replace most of the uses of KMALLOC/KFREE
so far with specific gc_malloc/gc_free calls. Given
that JanosVM is the place where a lot of great work on
the VM core happens, I hope we'll be able to merge in
some of the GC changes in a not too distant future.
Volunteers are welcome, as usual.

cheers,
dalibor topic

__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com




More information about the kaffe mailing list