Re: [rvm-research] question about heap layout

Robin Garner <[email protected]> Tue, 6 Mar 2018 14:33:31 +1100
Newsgroups gmane.comp.java.jikes.rvm.devel
Message-ID <[email protected]>
Operating systems and libraries tend to use low addresses for things 
like the 'malloc' heap.  Unfortunately Linux isn't particularly friendly 
to the idea that an application will want to manage its virtual address 
layout.  This puts it at odds with MMTk which relies on heap layout to 
determine allocation and GC policy for heap objects.

We work around this by leaving an amount of low-order memory 
unallocated.  The default lower bound is one that works for most 
systems, but if you really need to push the heap size in a 32-bit heap 
you are free to play with the boundaries. You can be a bit more 
scientific by writing a simple Java program that prints the contents of 
/proc/self/maps, in order to find out what your particular OS uses (of 
course you can't prevent other libraries loading in the middle of your 
heap, but that's another story).  Last time I needed to do something 
similar I was able to push the heap range to around 0x3000_0000-0xd000_0000.

> (1) Why is there an unused chunk at the bottom of the heap space for 64 bit systems?

Couple of reasons.
a) while ia32 (ans x64) Linux seems to only use high addresses for 
libraries and heaps, PPC linux still mabs the text segment and heap into 
low memory, eg

10000000-10010000 r-xp 00000000 fd:04 2230787                            
/usr/bin/cat
10010000-10020000 r--p 00000000 fd:04 2230787                            
/usr/bin/cat
10020000-10030000 rw-p 00010000 fd:04 2230787                            
/usr/bin/cat
10019710000-10019740000 rw-p 00000000 00:00 0                            
[heap]
3fff90190000-3fff96a30000 r--p 00000000 fd:04 2503411                    
/usr/lib/locale/locale-archive
...
3fff96c90000-3fff96ca0000 rw-p 00030000 fd:04 2261967                    
/usr/lib64/ld-2.17.so
3fffc15e0000-3fffc1610000 rw-p 00000000 00:00 0                          
[stack]

(Kernel 3.10.0 on Centos 7 (gcc112.fsffrance.org))

b) Having addresses that are 'below' the MMTk heap helps with debugging, 
to find (eg) addresses that have been truncated down to 32-bits.

HTH,

RObin

On 06/03/18 11:41, Shoaib Akram wrote:
> Hi All,
>
> I have a couple of questions about heap layout:
>
> (1) Why is there an unused chunk at the bottom of the heap space for 64 bit systems?
>
> (2) Is the start of the boot address space (and heap start) arbitrary? Similarly for heap end? How can these constants be changed.
>
> Regarding (2), some of my apps can benefit from bigger heaps, but with current setting, a lot of the virtual heap space is unused.
>
> Regards,
> Shoaib
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Jikesrvm-researchers mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Jikesrvm-researchers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers