public inbox for java@gcc.gnu.org
 help / color / mirror / Atom feed
* java memory allcation with gcj
@ 2009-11-04 19:24 isuru herath
  2009-11-05  9:23 ` java memory allocation " Andrew Haley
  0 siblings, 1 reply; 2+ messages in thread
From: isuru herath @ 2009-11-04 19:24 UTC (permalink / raw)
  To: java

Dear All,

I am interested in studying how "new" allocates memory when running as native binary. For this I wrote a simple Java class which just create an int array. Then I generate the assembly with gcj -S option. There I spotted the call to _Jv_NewPrimArray. Since the result of the call is stored in eax register I check the value of the eax register after this call. But it is giving a small number. I tried the same thing with C. There I spotted the call to malloc and check the eax after the malloc call and it has the same value as the &variable_name has.

So my objective is to identify the are of memory allocated by "new". Any help/advice on this regard is greatly appreciated.

thanks and regards,
Isuru


      

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: java memory allocation with gcj
  2009-11-04 19:24 java memory allcation with gcj isuru herath
@ 2009-11-05  9:23 ` Andrew Haley
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Haley @ 2009-11-05  9:23 UTC (permalink / raw)
  To: isuru herath; +Cc: java

isuru herath wrote:

 > I am interested in studying how "new" allocates memory when running
 > as native binary. For this I wrote a simple Java class which just
 > create an int array. Then I generate the assembly with gcj -S
 > option. There I spotted the call to _Jv_NewPrimArray. Since the
 > result of the call is stored in eax register I check the value of
 > the eax register after this call. But it is giving a small number. I
 > tried the same thing with C. There I spotted the call to malloc and
 > check the eax after the malloc call and it has the same value as the
 > &variable_name has.

_Jv_NewPrimArray calls the memory allocator (actually part of the
Boehm garbage collector) which calls
mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_PRIVATE, ..) to map
the memory.

Andrew.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-11-05  9:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-04 19:24 java memory allcation with gcj isuru herath
2009-11-05  9:23 ` java memory allocation " Andrew Haley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).