Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Nov 2009 16:02:05 -0800
From:      Maxim Sobolev <sobomax@sippysoft.com>
To:        Jason Evans <jasone@FreeBSD.org>
Cc:        FreeBSD Hackers <freebsd-hackers@FreeBSD.org>
Subject:   Re: heap limits: mmap(2) vs. break(2) on i386
Message-ID:  <4B10687D.3050209@sippysoft.com>
In-Reply-To: <4B1059CA.6040605@FreeBSD.org>
References:  <4B1041EB.9020109@sippysoft.com> <4B1059CA.6040605@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Jason Evans wrote:
> Maxim Sobolev wrote:
>> I am trying to figure out why java fails to start with 1024MB of heap 
>> on i386 with 4GB of RAM and 4GB of swap. Both MAXDSIZ and DFLDSIZ are 
>> set to 2GB.
> 
> Some memory (1GiB?) is reserved for kernel address space, and you 
> reserved 2GiB for DSS.  That leaves less than 1GiB available after 
> shared libraries and whatnot are mapped.  If there is more than 1GiB 
> available, mmap can still fail due to the memory being non-contiguous.

Jason,

So, are you saying that by allocating 2GB to MAXDSIZ, I limit myself 
less than 1GB left to be allocated via mmap()?

Perhaps the cause of the problem is my interpretation of MAXDSIZ as an 
overall limit of VM that the process will be able to allocate regardless 
of the memory management interface is wrong, and in fact the process can 
allocate up to MAXDSIZ using sbrk(2) and then some extra using mmap(2) 
up to 3GB?

I tried lowering DFLDSIZ to 1.5GB, and it helped with Java. What is the 
best strategy if I want to maximize amount of memory available to 
applications? Most of modern applications use mmap(), isn't it? Then 
where MAXDSIZ can bite me if I set it to say 512MB?

-Maxim



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4B10687D.3050209>