unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Daniel Colascione <dancol@dancol.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>,
	Andreas Schwab <schwab@suse.de>
Cc: "Ondřej Bílka" <neleai@seznam.cz>,
	emacs-devel@gnu.org, "Paul Eggert" <eggert@cs.ucla.edu>
Subject: Re: [RFC] Replacing malloc_get_state functionality.
Date: Mon, 24 Feb 2014 15:51:47 -0800	[thread overview]
Message-ID: <530BDB13.5040601@dancol.org> (raw)
In-Reply-To: <jwv1tyss2kw.fsf-monnier+emacs@gnu.org>

On 02/24/2014 12:01 PM, Stefan Monnier wrote:
>>> This tells 'configure' to assume that malloc_get_state does not work.
>> Does it still work, though?
>
> And doesn't this have some impacts in terms of Emacs's memory use
> (e.g. retaining more memory instead of returning it via munmap)?

Based on comments in the code, I'm not sure Emacs can operate correctly 
using the system dlmalloc without malloc_set_state:

/* malloc can be invoked even before main (e.g. by the dynamic
    linker), so the dumped malloc state must be restored as early as
    possible using this special hook.  */

When DOUG_LEA_MALLOC is unset, we skip some other heap manipulations 
(like restrictions on mmap allocation of lisp objects) that seems 
essential for correctness.

After the feature freeze, I'd like to look into moving Emacs away from 
sbrk-based allocators in general. It's tremendously wasteful of commit 
charge to keep a large data segment around. (Yes, GNU/Linux systems 
typically overcommit memory, which lessens the impact of the waste. Two 
wrong don't make a right.)

jemalloc works very well for other long-running programs (like Firefox), 
and although good support for concurrent allocation is one of jemalloc's 
main selling points, its fragmentation avoidance features are actually 
much more attractive to me right now.

This work will require breaking support on all platforms for dumping a 
dumped Emacs, but I'm not aware of any platform on which this feature 
works anyway.

Ondřej, are you planning on adding fragmentation resistance to the glibc 
malloc?



  reply	other threads:[~2014-02-24 23:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-20 23:29 [RFC] Replacing malloc_get_state functionality Ondřej Bílka
2014-02-21  7:38 ` Paul Eggert
2014-02-24 15:05   ` Ondřej Bílka
2014-02-24 15:31   ` Andreas Schwab
2014-02-24 20:01     ` Stefan Monnier
2014-02-24 23:51       ` Daniel Colascione [this message]
2014-02-25  2:11         ` Paul Eggert
2014-03-04 10:31         ` Ondřej Bílka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=530BDB13.5040601@dancol.org \
    --to=dancol@dancol.org \
    --cc=eggert@cs.ucla.edu \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=neleai@seznam.cz \
    --cc=schwab@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).