|
From: Farid A. <far...@ho...> - 2003-10-23 17:58:00
|
Hi
Was anyone able to load and use libjvm on valgrind ? No matter how much
stack memory I give it using -Xss it still asks for more (I went up to 420
MB). I tried debugging the problem with gdb, but gdb could not trace the
instrumented code(is there a trick to fix that ?), I could only debug
valgrind's code. I don't see why the thread's C stack has to expand that
much when using valgrind.
(from java man page)
Each Java thread has two stacks: one for Java code and one for C code. The
-Xss option sets the maximum stack size that can be used by C code in a
thread to n. Every thread that is spawned during the execution of the
program passed to java has n as its C stack size. The default units for n
are bytes and n must be > 1000 bytes.
the following code created the problem:
/*
load libjvm.so and returns a handle to JNI_CreateJavaVM
vmlibpath points to /jre1.4.1/lib/i386/server/libjvm.so
*/
void *JNU_FindCreateJavaVM(char *vmlibpath)
{
// void *libVM = dlopen(vmlibpath, RTLD_LAZY |RTLD_GLOBAL);
void *libVM = dlopen(vmlibpath, RTLD_NOW | RTLD_GLOBAL);
if (libVM == NULL) {
return NULL;
}
return dlsym(libVM, "JNI_CreateJavaVM");
}
/*
the Fatal error requesting more memory happens when the following (java api)
function is executed
the handle to this function was returned by the previous funtion
*/
res = JNI_CreateJavaVMFcn(&jvm, (void**)&env, &vm_args);
Using no skin:
Valgrind --skin=none -v invoke
=30964== Nulgrind, a binary JIT-compiler for x86-linux.
==30964== Copyright (C) 2002-2003, and GNU GPL'd, by Nicholas Nethercote.
==30964== Using valgrind-20031012, a program supervision framework for
x86-linux.
==30964== Copyright (C) 2000-2003, and GNU GPL'd, by Julian Seward.
==30964== Command line:
==30964== invoke
==30964== Startup, with flags:
==30964==
--suppressions=/local/fabizeid/valgrnd/lib/valgrind/default.supp
==30964== -v
==30964== Reading syms from invoke
==30964== Reading syms from /lib/ld-2.2.5.so
==30964== Reading syms from /valgrnd/lib/valgrind/vgskin_none.so
==30964== Reading syms from /valgrnd/lib/valgrind/valgrind.so
==30964== Reading syms from /lib/libdl-2.2.5.so
==30964== Reading syms from /valgrnd/lib/valgrind/libpthread.so
==30964== Reading syms from /lib/libc-2.2.5.so
==30964== Reading syms from /gcc-3.2.3/lib/libgcc_s.so.1
==30964== Estimated CPU clock rate is 2003 MHz
==30964==
==30964== Reading syms from /jre1.4.1/01_gcc3.2/lib/i386/server/libjvm.so
==30964== Reading syms from /lib/libnsl-2.2.5.so
==30964== Reading syms from /gcc-3.2.3/lib/libstdc++.so.5.0.3
==30964== Reading syms from /lib/libm-2.2.5.so
JNI_CreateJavaVMFcn call happens here and causes the rest of the libraries
to be loaded.
==30964== Reading syms from
/jre1.4.1/01_gcc3.2/lib/i386/native_threads/libhpi.so
==30964== Reading syms from /jre1.4.1/01_gcc3.2/lib/i386/libverify.so
==30964== Reading syms from
/jdk1.4.1/01_gcc3.2/jre/lib/i386/client/libjvm.so
==30964== Reading syms from /jre1.4.1/01_gcc3.2/lib/i386/libjava.so
==30964== Reading syms from /jdk1.4.1/01_gcc3.2/jre/lib/i386/libverify.so
==30964== Reading syms from /jre1.4.1/01_gcc3.2/lib/i386/libzip.so
==30964== Reading syms from /jdk1.4.1/01_gcc3.2/jre/lib/i386/libjava.so
==30964== valgrind's libpthread.so: IGNORED call to: pthread_attr_destroy
==30964== valgrind's libpthread.so: KLUDGED call to: pthread_getattr_np
==30964== valgrind's libpthread.so: KLUDGED call to:
pthread_attr_getstackaddr
==30964== valgrind's libpthread.so: KLUDGED call to: pthread_getattr_np
==30964== valgrind's libpthread.so: KLUDGED call to:
pthread_attr_getstackaddr
==30964== valgrind's libpthread.so: IGNORED call to: pthread_attr_destroy
==30964== valgrind's libpthread.so: KLUDGED call to: pthread_getattr_np
==30964== valgrind's libpthread.so: KLUDGED call to:
pthread_attr_getstackaddr
Fatal: Stack size too small. Use 'java -Xss' to increase default stack size.
Abort
Thanks for any advice
Farid
_________________________________________________________________
Want to check if your PC is virus-infected? Get a FREE computer virus scan
online from McAfee.
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
|
|
From: Stephane D. <ste...@ex...> - 2003-10-24 17:04:52
|
Hello,
I got the same problem. I never manage to valgrind a program linking
libjvm.so, it always failed with a "not enough memory" error.
On Thu, 2003-10-23 at 18:32, Farid Abizeid wrote:
> Hi
> Was anyone able to load and use libjvm on valgrind ? No matter how much
> stack memory I give it using -Xss it still asks for more (I went up to 420
> MB). I tried debugging the problem with gdb, but gdb could not trace the
> instrumented code(is there a trick to fix that ?), I could only debug
> valgrind's code. I don't see why the thread's C stack has to expand that
> much when using valgrind.
>
> (from java man page)
> Each Java thread has two stacks: one for Java code and one for C code. The
> -Xss option sets the maximum stack size that can be used by C code in a
> thread to n. Every thread that is spawned during the execution of the
> program passed to java has n as its C stack size. The default units for n
> are bytes and n must be > 1000 bytes.
>
> the following code created the problem:
> /*
> load libjvm.so and returns a handle to JNI_CreateJavaVM
> vmlibpath points to /jre1.4.1/lib/i386/server/libjvm.so
> */
> void *JNU_FindCreateJavaVM(char *vmlibpath)
> {
> // void *libVM = dlopen(vmlibpath, RTLD_LAZY |RTLD_GLOBAL);
> void *libVM = dlopen(vmlibpath, RTLD_NOW | RTLD_GLOBAL);
> if (libVM == NULL) {
> return NULL;
> }
> return dlsym(libVM, "JNI_CreateJavaVM");
> }
>
> /*
> the Fatal error requesting more memory happens when the following (java api)
> function is executed
> the handle to this function was returned by the previous funtion
> */
>
> res = JNI_CreateJavaVMFcn(&jvm, (void**)&env, &vm_args);
>
>
>
> Using no skin:
>
> Valgrind --skin=none -v invoke
>
> =30964== Nulgrind, a binary JIT-compiler for x86-linux.
> ==30964== Copyright (C) 2002-2003, and GNU GPL'd, by Nicholas Nethercote.
> ==30964== Using valgrind-20031012, a program supervision framework for
> x86-linux.
> ==30964== Copyright (C) 2000-2003, and GNU GPL'd, by Julian Seward.
> ==30964== Command line:
> ==30964== invoke
> ==30964== Startup, with flags:
> ==30964==
> --suppressions=/local/fabizeid/valgrnd/lib/valgrind/default.supp
> ==30964== -v
> ==30964== Reading syms from invoke
> ==30964== Reading syms from /lib/ld-2.2.5.so
> ==30964== Reading syms from /valgrnd/lib/valgrind/vgskin_none.so
> ==30964== Reading syms from /valgrnd/lib/valgrind/valgrind.so
> ==30964== Reading syms from /lib/libdl-2.2.5.so
> ==30964== Reading syms from /valgrnd/lib/valgrind/libpthread.so
> ==30964== Reading syms from /lib/libc-2.2.5.so
> ==30964== Reading syms from /gcc-3.2.3/lib/libgcc_s.so.1
> ==30964== Estimated CPU clock rate is 2003 MHz
> ==30964==
> ==30964== Reading syms from /jre1.4.1/01_gcc3.2/lib/i386/server/libjvm.so
> ==30964== Reading syms from /lib/libnsl-2.2.5.so
> ==30964== Reading syms from /gcc-3.2.3/lib/libstdc++.so.5.0.3
> ==30964== Reading syms from /lib/libm-2.2.5.so
>
> JNI_CreateJavaVMFcn call happens here and causes the rest of the libraries
> to be loaded.
>
> ==30964== Reading syms from
> /jre1.4.1/01_gcc3.2/lib/i386/native_threads/libhpi.so
> ==30964== Reading syms from /jre1.4.1/01_gcc3.2/lib/i386/libverify.so
> ==30964== Reading syms from
> /jdk1.4.1/01_gcc3.2/jre/lib/i386/client/libjvm.so
> ==30964== Reading syms from /jre1.4.1/01_gcc3.2/lib/i386/libjava.so
> ==30964== Reading syms from /jdk1.4.1/01_gcc3.2/jre/lib/i386/libverify.so
> ==30964== Reading syms from /jre1.4.1/01_gcc3.2/lib/i386/libzip.so
> ==30964== Reading syms from /jdk1.4.1/01_gcc3.2/jre/lib/i386/libjava.so
> ==30964== valgrind's libpthread.so: IGNORED call to: pthread_attr_destroy
> ==30964== valgrind's libpthread.so: KLUDGED call to: pthread_getattr_np
> ==30964== valgrind's libpthread.so: KLUDGED call to:
> pthread_attr_getstackaddr
> ==30964== valgrind's libpthread.so: KLUDGED call to: pthread_getattr_np
> ==30964== valgrind's libpthread.so: KLUDGED call to:
> pthread_attr_getstackaddr
> ==30964== valgrind's libpthread.so: IGNORED call to: pthread_attr_destroy
> ==30964== valgrind's libpthread.so: KLUDGED call to: pthread_getattr_np
> ==30964== valgrind's libpthread.so: KLUDGED call to:
> pthread_attr_getstackaddr
> Fatal: Stack size too small. Use 'java -Xss' to increase default stack size.
> Abort
>
>
> Thanks for any advice
> Farid
>
> _________________________________________________________________
> Want to check if your PC is virus-infected? Get a FREE computer virus scan
> online from McAfee.
> http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: The SF.net Donation Program.
> Do you like what SourceForge.net is doing for the Open
> Source Community? Make a contribution, and help us add new
> features and functionality. Click here: http://sourceforge.net/donate/
> _______________________________________________
> Valgrind-users mailing list
> Val...@li...
> https://lists.sourceforge.net/lists/listinfo/valgrind-users
|