This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

problem when mapping malloc to GC_malloc.


Hi,

My JNI code includes redefinitions to the malloc, free and realloc
functions (shown below). These functions call GC_malloc, GC_free and
GC_realloc respectively. This is done so that any calls to the malloc
get allocated through the garbage collector. However this is failing
with segfault. Any clues why this does not work ?
I am using this code along with the libgcj library linked dynamically
with my application.

void *malloc(size_t size)
{
        return GC_malloc(size);
}

void *realloc(void *ptr, size_t size)
{
        return GC_realloc(ptr, size);
}

void free(void *ptr)
{
        GC_free(ptr);
}


regards
abhishek


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]