heap limits: mmap(2) vs. break(2) on i386

Andrew MacIntyre andymac at bullseye.apana.org.au
Sat Nov 28 10:39:43 UTC 2009


Maxim Sobolev wrote:
> Jason Evans wrote:

>> I would set MAXDSIZ to 0, so that the maximum amount of memory is 
>> available for mapping shared libraries and files, and allocating via 
>> malloc.  This may cause problems with a couple of ports that implement 
>> their own memory allocators based on sbrk, but otherwise it should be 
>> all good.  You might also set /etc/malloc.conf  to 'd' in order to 
>> disable the sbrk calls.
> 
> I see, thank you for the explanation. One of the problem that we are 
> having is that we use a lot of interpreted languages in our environment 
> (python, php etc), and most of those implement their own memory 
> allocators, some of which rely on sbrk(2) unfortunately. I believe 
> that's where that 2GB limit of ours comes from - one of our Python 
> applications is very memory hungry and we had to bump that limit to 
> allow it sufficient room.

While Python has its own allocator, it relies on the platform malloc()
rather than sbrk(), and therefore Jason's suggestion to use '-d' in
/etc/malloc.conf should be effective for it.

-- 
-------------------------------------------------------------------------
Andrew I MacIntyre                     "These thoughts are mine alone..."
E-mail: andymac at bullseye.apana.org.au  (pref) | Snail: PO Box 370
        andymac at pcug.org.au             (alt) |        Belconnen ACT 2616
Web:    http://www.andymac.org/               |        Australia


More information about the freebsd-hackers mailing list