[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: When should ralloc.c be used?
From: |
Stefan Monnier |
Subject: |
Re: When should ralloc.c be used? |
Date: |
Mon, 24 Oct 2016 10:37:19 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux) |
> 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.
All allocators suffer from this problem. I haven't seen any evidence
that the mmap-based allocation code is significantly more prone to it.
Also, the glibc allocators used mmap internally when allocating
large-ish chunks (e.g. for buffer text), so if that was a problem, we
would have noticed, I think.
> (The MS-Windows emulation of mmap in w32heap.c reserves twice the
> number of pages as originally requested, for that very reason.)
Indeed, if this problem proves significant, there are fairly easy ways
to reduce its impact, such as using the kind of approach you mention.
Another advantage of using mmap is that it can return the memory to the
OS once you kill your large buffer, whereas with gmalloc+ralloc this
basically never happens, AFAIK.
Stefan
- Re: When should ralloc.c be used?, (continued)
- Re: When should ralloc.c be used?, Eli Zaretskii, 2016/10/23
- Re: When should ralloc.c be used?, Stefan Monnier, 2016/10/23
- Re: When should ralloc.c be used?, Eli Zaretskii, 2016/10/23
- Re: When should ralloc.c be used?, Stefan Monnier, 2016/10/23
- Re: When should ralloc.c be used?, Paul Eggert, 2016/10/24
- Re: When should ralloc.c be used?, Stefan Monnier, 2016/10/24
- Re: When should ralloc.c be used?, Eli Zaretskii, 2016/10/24
- Re: When should ralloc.c be used?, Stefan Monnier, 2016/10/24
- Re: When should ralloc.c be used?, Eli Zaretskii, 2016/10/24
- Re: When should ralloc.c be used?, Stefan Monnier, 2016/10/24
- Re: When should ralloc.c be used?,
Stefan Monnier <=
- Re: When should ralloc.c be used?, Eli Zaretskii, 2016/10/24
- Re: When should ralloc.c be used?, Daniel Colascione, 2016/10/24
- Re: When should ralloc.c be used?, Eli Zaretskii, 2016/10/24
- Re: When should ralloc.c be used?, Richard Stallman, 2016/10/24
- Re: When should ralloc.c be used?, Stefan Monnier, 2016/10/25
- Re: When should ralloc.c be used?, Stefan Monnier, 2016/10/25
- Re: When should ralloc.c be used?, Jérémie Courrèges-Anglas, 2016/10/28
- Re: When should ralloc.c be used?, Daniel Colascione, 2016/10/28
- Re: When should ralloc.c be used?, Jérémie Courrèges-Anglas, 2016/10/28
- Re: When should ralloc.c be used?, Eli Zaretskii, 2016/10/28