Re: malloc does not return null when out of memory

From: Jamie Bowden (ragnar_at_sysabend.org)
Date: 07/28/03

  • Next message: Jeff Love: "Re: Large hard disk support in FreeBSD"
    Date: Mon, 28 Jul 2003 10:14:03 -0700 (PDT)
    To: Brent Casavant <b.j.casavant@ieee.org>
    
    

    On Thu, 24 Jul 2003, Brent Casavant wrote:

    > [hopefully I didn't mess up the attribution, replying to a digest sucks]
    >
    > On Thu, 24 Jul 2003, Jamie Bowden wrote:
    >
    > > On Wed, 23 Jul 2003, Don Lewis wrote:
    > >
    > > > On 23 Jul, Brooks Davis wrote:
    > >
    > > > > No there isn't. Overcommit is a fundamental design feature of the BSD
    > > > > VM. If you don't like it, find an OS that doesn't do it. The only one
    > > > > I can think of off the top of my head in Irix where I've found it to be
    > > > > a serious pain in the ass.
    > >
    > > Irix allows for use of what it calls 'vswap' as well, which is just a file
    > > that lives on a normal filesystem that the system can fall back on when
    > > actual RAM and swap are exhausted. It allows for extremely large commits
    > > on memory limited systems while guaranteeing that it has somewhere to page
    > > out to if necessary. The poster above may not like Irix, but I do.
    > > There's a lot of good stuff in there, but SGI aren't the best at telling
    > > people it exists and how to use it.
    >
    > Almost. Having actually worked on the IRIX VM system, and on vswap
    > issues in particular...
    >
    > Don is correct in that IRIX doesn't overcommit. But that is only
    > the default swap configuration.
    >
    > The amount of "vswap" you add to the system is the amount by which
    > the VM system is allowed to overcommit total memory (real swap + RAM).
    > If the system is overcommitted and runs into a genuine memory outage,
    > then processes will start to be killed (hopefully intelligently).
    >
    > In particular "vswap" is not a file that lives in the normal filesystem
    > that gets swapped to. The somewhat ugly syntax for adding vswap
    > means that vswap does get configured along with a normal swap area
    > (file or device), but vswap itself has no backing store.

    Ah, yes, I had mis remembered the manual (from InfoSearch):

    Adding Virtual Swap Space

    If processes are being denied stack growth or new processes due to a
    stated lack of swap space, and you believe that there is adequate physical
    space, add the following entry to your /etc/fstab file:

    /usr/swap swap swap pri=4,vlength=204800 0 0

    Then give the command:

    mkfile -v 0b /usr/swap

    The file (/usr/swap) will be zero-length, so you have added only virtual
    swap space and no real swap area. Your kernel should then allow more
    processes to execute. However, when an attempt is made to access more than
    the system limit, the IRIX system swaps the largest running program out of
    memory.

    and:

    Turning On Virtual Swapping

    If swap -s reports a negative number, increase virtual swap when your
    system is not near its physical limits. This allows your system to
    allocate space to those applications that grab more space than they
    actually need. To do this, you can turn on virtual swapping by entering
    the following commands:

    su
    chkconfig vswap on
    /etc/init.d/swap start

    This allocates more swap space, or space that can be reserved but not
    allocated. See the /etc/init.d/swap file and the swap(1M) man page for
    more information.
    etc...

    You can create a normal file of larger than 0 length and allocate it as
    swap, which is (sort of) separate from vswap, but not really; I was
    merging the two in my head for some reason.

    Jamie Bowden

    -- 
    "It was half way to Rivendell when the drugs began to take hold"
    Hunter S Tolkien "Fear and Loathing in Barad Dur"
    Iain Bowen <alaric@alaric.org.uk>
    _______________________________________________
    freebsd-stable@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-stable
    To unsubscribe, send any mail to "freebsd-stable-unsubscribe@freebsd.org"
    

  • Next message: Jeff Love: "Re: Large hard disk support in FreeBSD"

    Relevant Pages

    • Re: excessive swap-in time
      ... Trying to do it all with RAM is just inefficient. ... I find that does not work well when the swapping is caused by excessive I/O ... Or you could have 5 TB of swap space. ...
      (comp.os.linux.development.system)
    • Summary swap rules.
      ... So it looks as if swap is mostly not used anymore and can be kept pretty ... Tim Bradshaw stated what I privately felt- that 1:1 swap to memory is ... so it's really only around for memory leaks and core dumps. ... think) which are written to swap space. ...
      (SunManagers)
    • RE: Where do you put your swap partition?
      ... so I can mount /tmp on a tmpfs file system. ... it, hits the disk several times, even with a large buffer cache. ... don't have enough ram, you have to swap, but you're no worse off than ... disk and /var on a third, and have swap space defined on all three. ...
      (Debian-User)
    • SUMMARY: What causes /tmp: File system full, swap space limit exceeded
      ... separate but on swap - standard solaris installation) and this ... Other solution is not using tmpfs but separate /tmp from swap ... Hargrave, Mark's response ... eating away your available VM swap space. ...
      (SunManagers)
    • Re: Is Greenspun enough?
      ... the swap copy can be liberated. ... This means that whatever swap space you configure nicely ... If you have a gigabyte of RAM, ... >gigabyte VM with one gigabyte of RAM, you need two gigabytes of disk ...
      (comp.lang.lisp)