This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: java memory allocation with gcj
- From: Andrew Haley <aph at redhat dot com>
- To: isuru herath <isuru81 at yahoo dot com>
- Cc: java at gcc dot gnu dot org
- Date: Thu, 05 Nov 2009 09:23:12 +0000
- Subject: Re: java memory allocation with gcj
- References: <278738.35725.qm@web56002.mail.re3.yahoo.com>
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.