MESSAGE
DATE | 2014-09-21 |
FROM | Ruben Safir
|
SUBJECT | Subject: [NYLXS - HANGOUT] Fwd: Re: realloc limitations
|
-------- Forwarded Message -------- Path: reader1.panix.com!panix!not-for-mail From: ruben safir Newsgroups: comp.lang.c Subject: Re: realloc limitations Date: Sun, 21 Sep 2014 04:00:46 +0000 (UTC) Organization: PANIX Public Access Internet and UNIX, NYC Lines: 42 Message-ID: References:
<541059de.19071671-at-news.xs4all.nl> NNTP-Posting-Host: 96.57.23.82 Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: reader1.panix.com 1411272046 5839 96.57.23.82 (21 Sep 2014 04:00:46 GMT) X-Complaints-To: abuse-at-panix.com NNTP-Posting-Date: Sun, 21 Sep 2014 04:00:46 +0000 (UTC) User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508 git://git.gnome.org/pan2) Xref: panix comp.lang.c:1049039
On Wed, 17 Sep 2014 09:15:46 +0200, Noob wrote:
> On 10/09/2014 23:15, Keith Thompson wrote: > >> On some systems, both realloc and malloc can allocate address space >> without allocationg physical memory, resulting in a failure later when >> you try to access the memory that you *think* you've already allocated. > > [Straying off-topic] > > As an example, cf. the Linux man page for malloc: > > http://man7.org/linux/man-pages/man3/malloc.3.html > > By default, Linux follows an optimistic memory allocation strategy. > This means that when malloc() returns non-NULL there is no guarantee > that the memory really is available. In case it turns out that the > system is out of memory, one or more processes will be killed by the > OOM killer. For more information, see the description of > /proc/sys/vm/overcommit_memory and /proc/sys/vm/oom_adj in proc(5), > and the Linux kernel source file > Documentation/vm/overcommit-accounting. > > http://man7.org/linux/man-pages/man5/proc.5.html > http://lxr.free-electrons.com/source/Documentation/vm/overcommit- accounting > > I disable overcommit on every system I come in contact with. > I wish 'disabled' were the default. > > Regards.
thankyou for this very insightful and useful writeup
Ruben
-- The Coin Hangout: http://www.coinhangout.com/home
|
|