[kaffe] Object Allocation in the heap
Xu Bac
xubacs@hotmail.com
Thu Apr 24 19:54:01 2003
Hello All,
I was trying to trace through the life-time of an object: what calls the
vm makes to allocate an object, and where the object is actually placed
etc... one thing that puzzles me is this:
in gc_heap_malloc(), essentially a block (small or large depending on
size) is removed from the freelist, memset-ted to zero, and returned. but
from the object data structure in java_lang_Object.h, i thought that the
object was supposed to look like
typedef struct Hjava_lang_Object {
struct _dispatchTable* dtable;
struct _iLock* lock;
/* Data follows on immediately */
} Hjava_lang_Object;
and there's a macro in object.h
#define OBJECT_DATA(OBJ) ((void*)((Hjava_lang_Object*)(OBJ)+1))
so in essence, if we just take a block from the heap, and allocate it with
just enough memory for the object data, and memset the whole of it to zero,
then where does the metadata(the dtable and the lock) go? or even
alternatively, given just a heap block how would i find the metadata for
that object? i would be very grateful if someone could give me some pointers
here!
cheers!
--xubacs
_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail