home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!usc!news!benton.prepress.com!bob
- From: bob@prepress.com (Robert Crowe)
- Newsgroups: comp.sys.sgi
- Subject: Re: Not enough swap space
- Message-ID: <1992Aug20.063826.20085@prepress.com>
- Date: 20 Aug 92 06:38:26 GMT
- References: <7085@charon.cwi.nl> <oplo2uo@fido.asd.sgi.com>
- Organization: Pre-Press Technologies, Carlsbad Ca.
- Lines: 67
-
- In article <oplo2uo@fido.asd.sgi.com> williams@agomoda.asd.sgi.com (Eric Williams) writes:
- >In <7085@charon.cwi.nl> robertl@cwi.nl (Robert van Liere) writes:
- >
- >
- >>A long, long time ago (i.e. in the 3.3.? days) Lance M Option @ NIH
- >>wrote :
- >>
- >>> SGI System Gurus:
- >>> We are experiencing problems with "malloc()". It seems
- >>> that if an amount of memory greater than the sum of
- >>> free memory and free swap space is requested, the malloc()
- >>> succeeds, but the program is killed by the OS when the
- >>> memory is used. How can this condition be caught? Can't
- >>> the OS give some indication to the user of why his proc died?
- >>
- >>We are currently experiencing this behavior as well. Can this condition
- >>be caught in 4.0.5 ? If not, is there something else we can do to avoid
- >>these (SysV related) "problems".
- >
- >I think the following should help. It ought to change the behavior so that
- >the malloc will fail. The default as shipped is to have behavior as you
- >describe. (This change might also mean that processes are limited to total
- >swap space, rather than the sum of swap space and physical memory. Sorry
- >I don't know for sure, so I can't say).
- >
- >Edit /usr/sysgen/master.d/kernel:
- >
- >/*
- > * preallocation of swap space
- > * 0 ==> disk space not preallocated for processes;
- > * !0 ==> disk space preallocated on fork/exec/sbrk/etc.
- > */
- >int availsmem_accounting = 0;
- >
- >
- >Change the 0 to 1. Run /etc/autoconfig. Reboot.
- >
- >-Eric Williams
-
- Note that this means when your 16 MB process does a system("ls"), or something
- similar, unless you have another 16 MB to run ls in, the fork will fail.
- At least thats how I understand it. I don't like it much myself - I don't
- understand what was so bad about vfork (then again I'm not that familiar with
- the internals of the operating system). The way it is now, you either never
- fork from a large program (but have a safe malloc), or you fork all you want,
- but roll the dice when you call malloc ( actually some point after that ).
-
- One nice thing about the default method is that you can change all of these:
-
- if (!ch = malloc(size))
- return err;
-
- To these:
-
- ch = malloc(size);
-
- Malloc simply will NOT fail for lack of memory. How many existing unix
- programs will break under this arrangement do you think?
-
-
- My 2 cents.
-
- --
- ============================================================
- Bob Crowe Voice: (619) 931-2695
- Pre-Press Technologies. Email: bob@prepress.com
- 2443 Impala dr. FAX: (619) 931-2698
-