A Danger Message From UNIX

Jay M. Libove root at libove.UUCP
Mon Apr 24 00:37:49 AEST 1989


>From article <3320 at homxb.ATT.COM>, by cjn at 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 at andrew.cmu.edu, libove at cs.cmu.edu,
5731 Centre Ave, Apt 3	gateway.sei.cmu.edu!libove!libove, jl42 at andrew.BITnet,
Pittsburgh, PA 15206	psuvax1!pitt!darth!libove!libove,
(412) 362-8983		or uunet!nfsun!libove!libove



More information about the Comp.unix.wizards mailing list