harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "LvJimmy,Jing" <firep...@gmail.com>
Subject Re: problem about System.loadLibrary and object's address
Date Sun, 29 Apr 2007 09:04:06 GMT
2007/4/29, 吴廷鹏 <wutingpeng@gmail.com>:
> Hi, all,
> when I use drlvm to execute my program, I found that when program has System.loadLibrary
call, there is always an error which reports "java.lang.outofmemoryerror <no stack trace
available>". The same program can run on Hotspot. Why this happens and how to solve it?
> Another question, I read the implementation code of Object.clone method in Object_generic.cpp.
> jobject object_clone(JNIEnv *jenv, jobject jobj)
> {
>     ObjectHandle h = (ObjectHandle) jobj;
>     //aquire the target address and assign it to variable named result
>     memcpy(result, h->object, size);
> }
> According to my comprehension, h->object is the address of java object. Is it ture?
Does this means I can use the same way to get the address of object in vmcore's other place
provided the necessary head file is included?

I suggest you ALWAYS use API structure and methods when writing native
codes(JNI, JVMTI, etc). The code you list here is too tricky and
depends on real implementation of JVM, I believe other JVM supports
Harmony may not use such structure, so your program may fail with
them, this is not you want, right?
I'm not sure what you want to do, why you need to access the address
of the object?

> Thanks,
> tingpeng


Best Regards!

Jimmy, Jing Lv
China Software Development Lab, IBM
View raw message