🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #2076

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

#2076
From: Kaz Kylheku
Date: Wed, 02 Dec 2026 00:33
51 lines
3736 bytes
On 2026-12-01, 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)

It's completely unrelated to fork. A virtual allocator reserves
regions of virtual memory, which become unavailable to other
allocations in that same address space.

Since it is possible (and common) for a system to give each process
its own virtual address space, a virtual allocation only makes
something unavailable to the same process; it doesn't reserve
virtual space in such a way that it is not available to another process.

A virtual allocation does require some global resources other than just
abstract space. The allocation has to be tracked somewhere (e.g.
tree structure like struct vm_area in Linux) and it is installed
into the page directory/tables of the process, which requires some
amount of memory (much smaller than what the virtual space would
occupy when fully populated by frames, but much larger than the zero
storage that totally uncommitted virtual space occupies).

The discipline by which new processes are created (fork, posix_spawn,
CreateProcess, ...) interacts with virtual memory but has no bearing on
the above basics.

It's possible to have a virtual memory system which has only one
address space. Some "DOS extenders" in the late 1980s and 1990s
were like this.

In effect, also, the Linux kernel is like this w.r.t. its own kernel
space virtual allocator, vmalloc. The virtual memory area
carved out by vmalloc is global inside the kernel; it doesn't switch
with the current running task.

-- 
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca
Technical Details
Message-ID: <20261201162425.955@kylheku.com>
Path: mbox-mo1.pugleaf.net!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> <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!srv.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: Kaz Kylheku <046-301-5902@kylheku.com>
Newsgroups: comp.lang.c
Subject: Re: is a wrapper on memory-allocation calls a good idea?
Date: Wed, 2 Dec 2026 00:33:08 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 51
Message-ID: <20261201162425.955@kylheku.com>
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: Wed, 02 Dec 2026 00:33:09 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="2506593"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18AlOkzeqkLkW57Y9sGbASVXe381+5/1cI="; posting-host="578f78a3435da8d35cab00a350e463cd"
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:0Y+I7I8RyzQmbWGJTE6Socphi+A= sha256:EMOwXGLnxVGVguoNTVigeOw6HEpAR88Jw54Op2PxBRM=
	sha1:f3xoMvBbDeDG+0/UmyTVy1fdCls= sha256:OWFBuAYCAjOLBItHCk4c5FjSiIdR8DEwo4KxZJ74Ifg=