memory limits

Matthew Dillon dillon at
Sun Sep 5 16:39:08 PDT 2004

:Hi there,
:I'm running a very memory intensive php 5.0 script through apache2 on a recent 
:DragonFly build (Sept 1).  My problem is that I'm running into some OS limit or 
:something.  I'm assuming this because I have 2G physical RAM and 4G swap, but 
:apache runs out of memory waaaay before then (maybe 500MB) even though top 
:reports 1400M Free.
:I've tried setting datasize to 'infinity' using `limits`, but that didn't stick 
:(I ran it again, and it still said datasize was limited to 524288).  I also 
:tried to adjust kern.ipc.shmmax to 6GB using `sysctl`, but it didn't make a 
:difference.  FYI, that variable's upper limit is 2147483647.
:What can I do to give apache2 access to all the addressable memory on this 

    The address space is broken up into several pieces.  The 'heap' space
    is what the datasize limit specifies and is limited to 512MB by the

    You can increase this space by setting the kern.maxdsiz loader
    variable to the number of bytes you want the process heap space
    to be.

    However, since these are 32 bit systems any given process only has 4GB
    of VM space.  1G is used by the kernel, 64MB is used by the stack, and
    you need to leave enough for mmap() as well so it is generally best not
    to set kern.maxdsiz larger then 2GB (e.g. 2147483648) or so.

    e.g. a /boot/loader.conf containing:


    Generally speaking if you want to work on very large data sets in linear
    memory you need to run on a 64 bit platform with a 64 bit kernel.
    DragonFly does not yet have any 64 bit platform support.  Otherwise you
    need to reformulate your program to reduce the directly addressed
    working set to something a 32 bit platform can handle.

					Matthew Dillon 
					<dillon at xxxxxxxxxxxxx>

More information about the Kernel mailing list