lkml.org 
[lkml]   [2000]   [Mar]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Overcomittable memory
Den 14-Mar-00 00:06:14 skrev bert hubert følgende om "Re: Overcomittable memory (Was: Linux 2.2.15pre12)":
> On Mon, Mar 13, 2000 at 12:13:37PM +0000, Paul Jakma wrote:

[cut programs not reacting appropriately to malloc() returning NULL)

>> then they should be fixed...

> Most of the time there is no proper way to deal with OOM. Being really out
> of memory probably means that you can't format your error message for
> example.

Well, guess what, then you won't get any error message, unless you were
clever enough to have allocated a string buffer previously. For some types
of programs, a counter for the number of times memory allocation failed is
useful, e.g. syslogd could log a "xx messages lost while memory was
unavailable" when memory allocations start to succeed again.

> Out of memory *really* means out of memory.

> Without reverting to things like exceptions, it's very hard to check for OOM
> errors every time you invoke malloc or strdup.

No, it's not. It is a fundamental part of programming once you leave the
"Hello World" stage, just as checking the return code from e.g. fopen() is.

> The code bloat involved in checking each and every function call will also
> cause lots of OOMs which otherwise would not have happened :-)

No. Program code has files to back up the address space. You really need
only one page of RAM for all the user space code executing on the system.

Regards,

/¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯T¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯\
| Rask Ingemann Lambertsen | E-mail: mailto:rask@kampsax.dtu.dk |
| Please do NOT Cc: to me or the | WWW: http://www.gbar.dtu.dk/~c948374/ |
| mailing list. I am on the list.| "ThrustMe" on XPilot, ARCnet and IRC |
| 03h:42m SLEEP? I'm a programmer! |


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:57    [W:0.199 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site