Article View: comp.lang.c
Article #2000Re: is a wrapper on memory-allocation calls a good idea?
From: Bonita Montero
Date: Mon, 30 Nov 2026 06:16
Date: Mon, 30 Nov 2026 06:16
21 lines
2421 bytes
2421 bytes
Am 30.11.2026 um 07:00 schrieb Lawrence D’Oliveiro: > You don’t even need a special wrapper to achieve that. On Linux > systems, you can set the memory-allocation policy to “overcommit”, > which basically means that, when a process asks for memory, the > kernel never says no <https://manpages.debian.org/proc_sys_vm(5)>. > > So you don’t even need to bother to check for memory-allocation > failures, because you will never get a failure status. Instead, > if/when the system runs low on memory, a kernel thread known as “the > dreaded OOM killer” is loosed from the mythical underground cave where > it is normally kept chained, and it starts killing processes, starting > with the biggest memory hogs, until sanity, in the form of an adequate > memory reserve, is restored to the system. > > In fact, this overcommit policy is usually the default setting. realloc() may be necessary nevertheless when a memory chunk isn't large enough. With overcommit you could allocate more memory than needed to reduce the likehood of realloc()s.
Technical Details
Message-ID:
<11ej4cd$5t50$1@raubtier-asyl.eternal-september.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!raubtier-asyl.eternal-september.org!.POSTED!not-for-mailReferences:
<11eh538$3fet7$1@dont-email.me> <11ehine$3kr02$1@dont-email.me> <11ej3eh$5ajn$3@dont-email.me>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!raubtier-asyl.eternal-september.org!.POSTED!not-for-mail From: Bonita Montero <Bonita.Montero@gmail.com> Newsgroups: comp.lang.c Subject: Re: is a wrapper on memory-allocation calls a good idea? Date: Mon, 30 Nov 2026 07:16:45 +0100 Organization: A noiseless patient Spider Lines: 21 Message-ID: <11ej4cd$5t50$1@raubtier-asyl.eternal-september.org> References: <11eh538$3fet7$1@dont-email.me> <11ehine$3kr02$1@dont-email.me> <11ej3eh$5ajn$3@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Mon, 30 Nov 2026 06:16:45 +0000 (UTC) Injection-Info: raubtier-asyl.eternal-september.org; logging-data="193696"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX182w7+JGPo41KDv26OTW+1SeN792owYkdI="; posting-host="74af7535fe23a1fc2eebd3fb26edb9d1" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:XmVVbHFIyrRjXgwVnli9PvGuGNs= sha256:WCXjGK1Ic30ZC03vmQLc9s/VF/Jjznpt9X/p3bJG5VU= sha1:SdJKktIYHKcO0peVrq11EfOrBQE= sha256:nve/zONmJIAY+VchIQY24gS/9O0drchneTZSrEnEBa0= Content-Language: de-DE In-Reply-To: <11ej3eh$5ajn$3@dont-email.me>