home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!gossip.pyramid.com!olivea!charnel!sifon!clouso.crim.ca!bond.IRO.UMontreal.CA!helfer
- From: helfer@IRO.UMontreal.CA (Peter Helfer)
- Newsgroups: comp.sys.sgi
- Subject: Re: Killed?
- Message-ID: <1992Nov19.213010.14582@clouso.crim.ca>
- Date: 19 Nov 92 21:30:10 GMT
- Sender: news@clouso.crim.ca
- Reply-To: helfer@IRO.UMontreal.CA (Peter Helfer)
- Organization: /usr/local/lib/rn/organization
- Lines: 44
- Originator: helfer@bond.crim.ca
- Nntp-Posting-Host: bond.crim.ca
-
- You ask malloc for a large amount of memory. Malloc says fine, here's a
- pointer. You try to access the memory and IRIX sends you an uncatchable
- SIGKILL!
-
- This may happen because the default behaviour in IRIX 4.0 is NOT to
- allocate swap space when a process increases its brk value, but only when it
- attempts to access its memory. At which point the process is killed if a
- a swap page cannot be allocated.
-
- Malloc effectively never returns NULL under IRIX 4.0, so there is no way
- to handle memory allocation problems gracefully. You don't even get a
- chance to save the user's data before exiting. Pretty awful.
-
- It is possible to change this behaviour, by modifying "availsmem_accounting"
- in /usr/sysgen/master.d/kernel and rebuilding the kernel, but:
-
- - According to some postings in this newsgroup, IRIX 4.0 does not
- perform very well with availsmem_accounting on, and SGI advises
- against it.
-
- - If you're writing commercial software, you typically can't tell your
- customers that they have to rebuild their kernel in order to run
- your program.
-
-
- According to SGI's customer support, availsmem_accounting was defaulted to
- OFF in IRIX 4.0 because many people did not like it on (for performance
- reasons, I suppose), but it seems that a fair number of people are upset and
- the default will be ON in the next release...
-
- Meanwhile SGI suggested the following kludge:
-
- 1. Before allocating memory, check that there is enough free swap
- space. An example program in
- /usr/people/4Dgifts/examples/unix/irix/freevmem.c shows how.
-
- 2. Call malloc.
-
- 3. Touch every page (512-byte segment) in the allocated memory.
-
- This is not completely reliable, though, because swap space may be consumed
- by another process between step 1 and 3, in which case the old SIGKILL
- will get you.
-
-