Double-U Tea Eff?!?!

by Brian Enigma on September 18, 2006 11:21pm

in Code

BUGS
By default, Linux fol­lows an opti­mistic mem­ory allo­ca­tion strat­egy.  This means that when mal­loc() returns non-NULL there is no guar­an­tee that the mem­ory really is avail­able. This is a really bad bug. In case it turns out that the sys­tem is out of mem­ory, one or more processes will be killed by the infa­mous OOM killer.  In case Linux is employed under cir­cum­stances where it would be less desir­able to sud­denly lose some ran­domly picked processes, and more­over the ker­nel ver­sion is suf­fi­ciently recent, one can switch off this over­com­mit­ting behav­ior using a com­mand like
# echo 2 > /proc/sys/vm/overcommit_memory
See also the ker­nel Doc­u­men­ta­tion direc­tory, files vm/overcommit-accounting and sysctl/vm.txt.

- the mal­loc man­ual page, empha­sis (ital­ics) added

Yes, kid­dies, mal­loc() returns non-null results when you have no mem­ory left.  You can even start to use that mem­ory, but at some point you hit the bar­rier between what you requested and what was really avail­able, and things go explodey and the ker­nel goes on a ran­dom killing spree.  I quote, “this is a really bad bug.”

Share and Enjoy:
  • Digg
  • Reddit
  • del.icio.us
  • StumbleUpon
  • Yahoo! Buzz
  • Facebook
  • Google Bookmarks
  • Technorati

If you liked this post, you may also enjoy:

  1. Verisign’s Wild­card
  2. LJRand­Text
  3. A LOSER IS YOU!
  4. Syn­ergy
  5. Apple­care

Leave a Comment

Previous post:

Next post: