🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #2149

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

#2149
From: Waldek Hebisch
Date: Thu, 03 Dec 2026 19:55
47 lines
3459 bytes
Lowell Gilbert <lgusenet@be-well.ilk.org> wrote:
> Andrey Tarasevich <noone@noone.net> writes:
> 
>> On Mon 11/30/2026 10:31 AM, Lawrence D’Oliveiro wrote:
>>> On Sun, 29 Nov 2026 22:44:26 -0800, Andrey Tarasevich wrote:
>>>> Well, firstly, overcommit approach simply substitutes "virtual
>>>> address space" in place of "actual memory" as the limited resource.
>>> No, it is actual memory that is being overcommitted.
>>
>> Yes, but the whole idea of "overcommiting" simply means that the
>> allocator will _reserve_ virtual address space without checking
>> whether there is physical storage to back it up.
> 
> and this happens because of the mechanics of (now POSIX) fork(), which
> unfortunately was built into the fundament decades ago (long before
> POSIX)
> 
>> Virtual address space of the process still needs to be reserved at the
>> moment of allocation. And virtual address space still gets "used up"
>> by such allocations. It can eventually run out. That is the point I
>> was making.
> 
> In theory, yes. But if it became (even foreseeably) a problem, we would
> probably build systems with larger address spaces, in which case
> "properly written" (ahem) C code would automatically use the larger
> space without any problem. This has, obviously, happened before.

IIUC big motivator was Java.  Due to JIT and GC Java code space
is writable.  And in is written to at application startup.
Normally this would prevent sharing, which could easily lead to
excessive memory use when several large Java applications are
simultaneously active.  So Java folks invented a trick: first
load all code in single process, then start actual applications
by forking this initial process.  Since after loading code
code space is mostly constant copy on the write means much
smaller use of real memory.  Overcommit was the next step,
allowing allocating large swap.  Additionally, heavy swapping
possible when actially used memory is bigger than real memory
makes servers unresponsive for possibly long time.  With
overcommit and small swap OOM killer will relatively quickly
kill runaway process(es), making system responsive again.

I personally do not like overcommit, but it is better than
swapping for hours or days.

-- 
                              Waldek Hebisch
Technical Details
Message-ID: <11eshfr$3f3rl$1@paganini.bofh.team>
Path: mbox-mo1.pugleaf.net!news-fra.pugleaf.net!news.tcpreset.net!newsfeed.bofh.team!paganini.bofh.team!not-for-mail
References: <11eh538$3fet7$1@dont-email.me> <11ehine$3kr02$1@dont-email.me> <11ej3eh$5ajn$3@dont-email.me> <11ej60c$6bhr$1@dont-email.me> <11ekfeo$mq5n$1@dont-email.me> <11emqek$1rpei$1@dont-email.me> <44jylstwpp.fsf@lowell-ubuntu25.lan>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-fra.pugleaf.net!news.tcpreset.net!newsfeed.bofh.team!paganini.bofh.team!not-for-mail
From: antispam@fricas.org (Waldek Hebisch)
Newsgroups: comp.lang.c
Subject: Re: is a wrapper on memory-allocation calls a good idea?
Date: Thu, 3 Dec 2026 19:55:41 -0000 (UTC)
Organization: bofh.team Usenet service
Message-ID: <11eshfr$3f3rl$1@paganini.bofh.team>
References: <11eh538$3fet7$1@dont-email.me> <11ehine$3kr02$1@dont-email.me> <11ej3eh$5ajn$3@dont-email.me> <11ej60c$6bhr$1@dont-email.me> <11ekfeo$mq5n$1@dont-email.me> <11emqek$1rpei$1@dont-email.me> <44jylstwpp.fsf@lowell-ubuntu25.lan>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 3 Dec 2026 19:55:41 -0000 (UTC)
Injection-Info: paganini.bofh.team; logging-data="3641205"; mail-complaints-to="usenet@bofh.team"; posting-host="d028f9ad2fa2c51f22dbfed0d81d7daf"; posting-account="69e66f1681224ab92235b464ce7a90b6"
User-Agent: tin/2.6.2-20221225 ("Pittyvaich") (Linux/6.1.0-9-amd64 (x86_64))
X-Postfilter: Postfilter-NG 2026.10.2