From f63fc858c3d4a7d91ccac850025e407cc57b77fc Mon Sep 17 00:00:00 2001 From: Fabrice Popineau Date: Sat, 17 May 2014 10:14:59 +0300 Subject: [PATCH] Always map new memory for buffers after dumping. src/buffer.c (init_buffer) [USE_MMAP_FOR_BUFFERS]: Always map new memory for every buffer that was dumped. --- src/ChangeLog | 5 +++++ src/buffer.c | 21 +++++++++++---------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index f82a6a298ae..a89d14bbe23 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2014-05-17 Fabrice Popineau + + * buffer.c (init_buffer) [USE_MMAP_FOR_BUFFERS]: Always map new + memory for every buffer that was dumped. + 2014-05-15 Dmitry Antipov * fns.c (Freverse): Allow vectors, bool vectors and strings. diff --git a/src/buffer.c b/src/buffer.c index a1142479d04..1f0bd3f0970 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -5336,16 +5336,17 @@ init_buffer (void) ptrdiff_t len; #ifdef USE_MMAP_FOR_BUFFERS - { - /* When using the ralloc implementation based on mmap(2), buffer - text pointers will have been set to null in the dumped Emacs. - Map new memory. */ - struct buffer *b; - - FOR_EACH_BUFFER (b) - if (b->text->beg == NULL) - enlarge_buffer_text (b, 0); - } + { + struct buffer *b; + + /* We cannot dump buffers with meaningful addresses that can be + used by the dumped Emacs. We map new memory for them here. */ + FOR_EACH_BUFFER (b) + { + b->text->beg = NULL; + enlarge_buffer_text (b, 0); + } + } #endif /* USE_MMAP_FOR_BUFFERS */ Fset_buffer (Fget_buffer_create (build_string ("*scratch*"))); -- 2.39.5