home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / sys / sgi / 16657 < prev    next >
Encoding:
Internet Message Format  |  1992-11-19  |  2.2 KB

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