emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: When should ralloc.c be used?


From: Eli Zaretskii
Subject: Re: When should ralloc.c be used?
Date: Mon, 24 Oct 2016 16:05:30 +0300

> From: Stefan Monnier <address@hidden>
> Date: Mon, 24 Oct 2016 08:33:10 -0400
> Cc: address@hidden
> 
> >   Should Emacs use the GNU version of malloc?             yes
> >   Should Emacs use a relocating allocator for buffers?    yes
> >   Should Emacs use mmap(2) for buffer allocation?         no
> > because emacs-25 will compile both gmalloc.o and ralloc.o on such a 
> > platform.
> 
> But I fail to see what's hard about changing that to "rel_alloc=no, mmap=yes".

Why do we need mmap at all?  Why not just use malloc (as implemented
by gmalloc)?

Using mmap has disadvantages: when you need to enlarge buffer text,
and that fails (because there are no more free pages/addresses after
the already allocated region), we need to copy buffer text to the new
allocation.  This happens quite a lot when we visit a compressed
buffer.  (The MS-Windows emulation of mmap in w32heap.c reserves twice
the number of pages as originally requested, for that very reason.)

So if we can stop using ralloc without also using mmap directly for
buffer text, that'd be a win, I think.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]