mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@aerifal.cx>
To: musl@lists.openwall.com
Subject: Re: holywar: malloc() vs. OOM
Date: Mon, 25 Jul 2011 15:21:41 -0400	[thread overview]
Message-ID: <20110725192141.GP132@brightrain.aerifal.cx> (raw)
In-Reply-To: <20110725174343.GB4462@albatros>

On Mon, Jul 25, 2011 at 09:43:43PM +0400, Vasiliy Kulikov wrote:
> Rich,
> 
> On Sun, Jul 24, 2011 at 18:19 -0400, Rich Felker wrote:
> > Any system without this guarantee is a TOY, nothing more. I'm aware
> > that the default sucks,
> 
> I don't think the default sucks, it is just targeted to other programs.

I disagree. I think the default discourages writing safe, robust
applications (people always say "Why should I check the result of
malloc? It will return success then crash later anyway because of
overcommit.") and encourages writing broken hackware that depends on
the availability of overcommit.

> Think about Java/Python programs, which request hundreds megabytes, but
> using only tens of them.

This is not a valid way to write applications. It's basically the same
as the classic joke about Windows 95 containing:

    if (rand()%1000==42) bsod();

I'm also a bit unsure how a Java or Python program would allocate
hundreds of megs but leave them completely untouched. Usually HLL's
dirty memory as soon as they allocate it with initialization, object
construction, etc. so I'm doubtful your example has anything to do
with the real world...

> Also daemons with fork() model being able to
> handle hundreds/thousands connections actively using COW would not be
> able to fully exploit COW potential.

As long as the main daemon (prior to accepting connections) does not
use much memory, it's not an issue. If it is an issue, just throw in
an extra hard drive that's always spun down with a few TB of swap
space and the commit allowance will go through the roof.

Also, if you'll be calling exec after fork, posix_spawn is available
as an option. On a good implementation, it can/will use vfork or some
other clone variant to avoid increasing the commit charge in the
window between fork and exec.

Rich


  reply	other threads:[~2011-07-25 19:21 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-24 10:33 Vasiliy Kulikov
2011-07-24 12:40 ` Rich Felker
2011-07-24 13:29   ` Szabolcs Nagy
2011-07-24 13:27     ` Rich Felker
2011-07-24 18:33       ` Vasiliy Kulikov
2011-07-24 22:24         ` Rich Felker
2011-07-24 18:25   ` Vasiliy Kulikov
2011-07-24 22:19     ` Rich Felker
2011-07-25 17:43       ` Vasiliy Kulikov
2011-07-25 19:21         ` Rich Felker [this message]
2011-07-24 12:44 ` Szabolcs Nagy
2011-07-24 12:53   ` Szabolcs Nagy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110725192141.GP132@brightrain.aerifal.cx \
    --to=dalias@aerifal.cx \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).