🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #2240

Re: is a wrapper on memory-allocation calls a good idea?

#2240
From: Tristan Wibberley
Date: Sat, 05 Dec 2026 08:41
38 lines
3233 bytes
On 30/11/2026 18:34, Lawrence D’Oliveiro wrote:
> On Mon, 30 Nov 2026 07:16:45 +0100, Bonita Montero wrote:
> 
>> Am 30.11.2026 um 07:00 schrieb Lawrence D’Oliveiro:
>>
>>> 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)>.
>>
>> 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.
> 
> Runtime memory allocators normally works in bigger units than
> individual allocation requests, anyway. This is orthogonal to the
> overcommit policy (or not) as supported by the kernel.
> 
> What the Linux policy option allows is you can simply forget to
> check for out-of-memory errors.

Not really, your process has a limited address space too, you will get
an allocation failure when there's nowhere for your object to be mapped,
not just when there's no otherwise unoccupied memory cells for it's
state to be retained in.

-- 
Tristan Wibberley

The message body is Copyright (C) 2026 Tristan Wibberley except
citations and quotations noted. All Rights Reserved except that you may,
of course, cite it academically giving credit to me, distribute it
verbatim as part of a usenet system or its archives, and use it to
promote my greatness and general superiority without misrepresentation
of my opinions other than my opinion of my greatness and general
superiority which you _may_ misrepresent. You definitely MAY NOT train
any production AI system with it but you may train experimental AI that
will only be used for evaluation of the AI methods it implements.
Technical Details
Message-ID: <11f0iom$2i7jn$7@dont-email.me>
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mo.newsdeef.eu!srv.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
References: <11eh538$3fet7$1@dont-email.me> <11ehine$3kr02$1@dont-email.me> <11ej3eh$5ajn$3@dont-email.me> <11ej4cd$5t50$1@raubtier-asyl.eternal-september.org> <11ekfj1$mq5n$2@dont-email.me>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mo.newsdeef.eu!srv.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: Tristan Wibberley <tristan.wibberley+netnews2@alumni.manchester.ac.uk>
Newsgroups: comp.lang.c
Subject: Re: is a wrapper on memory-allocation calls a good idea?
Date: Sat, 5 Dec 2026 08:41:58 +0000
Organization: A noiseless patient Spider
Lines: 38
Message-ID: <11f0iom$2i7jn$7@dont-email.me>
References: <11eh538$3fet7$1@dont-email.me> <11ehine$3kr02$1@dont-email.me>
 <11ej3eh$5ajn$3@dont-email.me>
 <11ej4cd$5t50$1@raubtier-asyl.eternal-september.org>
 <11ekfj1$mq5n$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 05 Dec 2026 08:42:00 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="2694775"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+pMbap5lyw6hkkU5lBnklFzJrCNxWAJLr+NfIA/Ej07g=="; posting-host="e210ba6551fa09f4d8612e67f408742d"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:QCP0uzh4m20m6ZS2V393UCAqYgk= sha256:Fhh1LJL24ApACanxJizzV5M/41RSGmFBt/Ga+KwMzo8=
	sha1:XYU0l++EW+P60CSANH6Tg7OrljE= sha256:Hu9vkUnnQe/0B8OsAIEAX/36aAvRHjDtv/1j1/ckGZI=
Content-Language: en-GB
In-Reply-To: <11ekfj1$mq5n$2@dont-email.me>