Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!xanth!lll-winken!uunet!nfsun!libove!root From: root@libove.UUCP (Jay M. Libove) Newsgroups: comp.unix.wizards Subject: Re: A Danger Message From UNIX Message-ID: <252@libove.UUCP> Date: 23 Apr 89 14:37:49 GMT References: <3320@homxb.ATT.COM> Distribution: usa Organization: Libove.UUCP Lines: 33 From article <3320@homxb.ATT.COM>, by cjn@homxb.ATT.COM (C.NORTHRUP): > for(i=0;i<4096;++i) > if( (memptr[i] = malloc(80540)) == (char *) NULL) > { > perror("mt"); > break; > } > While running multiple versions of this in the background, > (loged on as a general user) the following message started > appearing on the system console: > DANGER: out of swap space. > Since the five (or so) invocations of the program consumed > minimal space prior to the mallocs, how should the OS > have handled this? Should the mallocs have failed? > Or is this considered acceptable. I think you'll find that the malloc() calls _did_ fail, and that the warning message occurs because an attempt to grab that much swap space failed - not that the system alloc'd all of the remaining space, and now has zero free space in the swap area. Serious counter question: What kind of application needs to allocate 4000 chunks of 80Kbytes each, and be run five times simultaneously? ------------- Jay Libove jl42@andrew.cmu.edu, libove@cs.cmu.edu, 5731 Centre Ave, Apt 3 gateway.sei.cmu.edu!libove!libove, jl42@andrew.BITnet, Pittsburgh, PA 15206 psuvax1!pitt!darth!libove!libove, (412) 362-8983 or uunet!nfsun!libove!libove