Why kernel kills processes that run out of memory instead of just failing memory allocation system calls?

Ilya Orehov elias at artx.ru
Thu May 21 08:12:51 UTC 2009


+------- Yuri, 2009-05-20 -------
| Seems like failing system calls (mmap and sbrk) that allocate memory is more
| graceful and would allow the program to at least issue the reasonable 
| error message.
| And more intelligent programs would be able to reduce used memory 
| instead of just dying.

Hi!

You can set memory limit to achieve your goal:

tcsh% limit vmemoryuse 20M

In this case, malloc(1000000000) will return 0.

Ilya.

| 
| Yuri
| 
| _______________________________________________
| freebsd-hackers at freebsd.org mailing list
| http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
| To unsubscribe, send any mail to "freebsd-hackers-unsubscribe at freebsd.org"
| 
+-----------------------------


More information about the freebsd-hackers mailing list