[kaffe] java.lang.UnsatisfiedLinkError: not enough memory

Ito Kazumitsu kaz at maczuka.gcd.org
Mon Jun 2 15:35:01 PDT 2003


>>>>> ":" == Ito Kazumitsu <kaz at maczuka.gcd.org> writes:

:> I have found a bug in libltdl/ltdl.c.
:> 
:> In argz_create_sep(), LT_DLMALLOC() allocates some memory.
:> And in argz_append(), LT_DLREALLOC() tries to expand it.
:> 
:> While LT_DLMALLOC() uses KMALLOC(), which does not call malloc(),
:> LT_DLREALLOC() uses realloc(), which requires that the memory
:> should have been allocated by malloc().
:> 
:> In ltdl.c, there is a code for realloc() enclosed in "##if 0
:> .. ##endif".  I think this can be used if it is renamed as
:> rpl_realloc.

I think my patch posted last time is somewhat dirty.

I found the patch attached below also works and looks better.
I think lt_dlmalloc/lt_dlfree may well use malloc/free because
on a platform which has its own argz_* functions,  which seem
to be in glibc,  malloc/free seems to be used in argz_* functions.

Anyway,  I think this issue should be settled before the new release.


--- kaffe/kaffevm/external.c.orig	Fri Apr 25 04:36:20 2003
+++ kaffe/kaffevm/external.c	Tue Jun  3 07:12:32 2003
@@ -53,6 +53,7 @@
 #endif
 
 #ifndef LIBRARYINIT
+/*  rpl-realloc in ltdl.c must use malloc();
 static inline lt_ptr_t kdlmalloc(size_t len) { 
 	void *ptr = KMALLOC(len);
 	addToCounter(&ltmem, "vmmem-libltdl", 1, GCSIZEOF(ptr));
@@ -62,7 +63,8 @@
 	addToCounter(&ltmem, "vmmem-libltdl", 1, -((jlong)GCSIZEOF(ptr)));
 	KFREE(ptr); 
 }
-#define LIBRARYINIT() ((lt_dlmalloc=kdlmalloc),(lt_dlfree=kdlfree),lt_dlinit())
+#define LIBRARYINIT() ((lt_dlmalloc=kdlmalloc),(lt_dlfree=kdlfree),lt_dlinit()) */
+#define LIBRARYINIT() ((lt_dlmalloc=malloc),(lt_dlfree=free),lt_dlinit())
 #endif
 
 #ifndef LIBRARYSUFFIX




More information about the kaffe mailing list