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

Ito Kazumitsu kaz@maczuka.gcd.org
Sun Jun 1 03:48:02 2003


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

:> When I try to use AWT,  the following message appears.  Is this because
:> I do not have enough memory?
:> 
:> bash-2.05b$ LD_LIBRARY_PATH=/usr/local/kaffe/jre/lib/i386 java org.hsqldb.util.DatabaseManager        
:> kaffe-bin in realloc(): warning: pointer to wrong page
:> kaffe-bin in realloc(): warning: pointer to wrong page

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.

So I tried the following and it worked for me.

--- ltdl.c.orig	Wed May  7 14:29:10 2003
+++ ltdl.c	Sun Jun  1 19:29:37 2003
@@ -211,8 +211,8 @@
 static lt_ptr lt_emalloc	LT_PARAMS((size_t size));
 static lt_ptr lt_erealloc	LT_PARAMS((lt_ptr addr, size_t size));
 
-/* static lt_ptr rpl_realloc	LT_PARAMS((lt_ptr ptr, size_t size)); */
-#define rpl_realloc realloc
+static lt_ptr rpl_realloc	LT_PARAMS((lt_ptr ptr, size_t size));
+/* #define rpl_realloc realloc */
 
 /* These are the pointers that can be changed by the caller:  */
 LT_GLOBAL_DATA lt_ptr (*lt_dlmalloc)	LT_PARAMS((size_t size))
@@ -512,9 +512,10 @@
      how much to copy.  That's not right, but you can't know the size
      of the source unless you know enough about, or wrote malloc.  So
      this code is disabled... */
-
+#endif
 static lt_ptr
-realloc (ptr, size)
+/* realloc (ptr, size) */
+rpl_realloc (ptr, size)
      lt_ptr ptr;
      size_t size;
 {
@@ -549,7 +550,7 @@
       return mem;
     }
 }
-#endif
+/* #endif */
 
 
 #if ! HAVE_ARGZ_APPEND