java memory allocation with gcj

Andrew Haley aph@redhat.com
Thu Nov 5 12:13:00 GMT 2009


isuru herath wrote:
> Hi Andrew,
> 
> Thanks for the reply. So I was thinking soon after the call to 
> _Jv_NewPrimArray the eax register should have the starting location of the 
> the memory allocated by the mmap. But the value at the eax register was 
> 166816.

So, if you're in gdb, try

   x $eax

166816 doesn't seem unreasonable.  It can be a valid address.

> When I tried this with C, the value at the eax register after the 
> malloc call was 155648008. I also put a printf(&name) in the C code and it 
> prints the same address.
> Then I tried store a value in the Java array and then tried to read the 
> memory address 166816 and it wasnot giving me the value that I stored in my 
> program. 

I think I need to see a test case.  Please, I need the code, and the steps
you took.

> Even the memory addresses given from C and java are different in sizes as well.
> 
> Am I missing something here. I just need to know how to find the address of 
> the block allocated by the "new" when running as native binary.
> 
> any help/advice on this regard is greatly appreciated.

Hard to say.  I know you must be doing something wrong, but I don't
know what.  If you can send me a test case that illustrates what
you're doing, I'll have a look.

Andrew.



More information about the Java mailing list