- /* 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);
- }
- }
+#ifndef WINDOWSNT
+ /* These must be reset in the dumped Emacs, to avoid stale
+ references to mmap'ed memory from before the dump.
+
+ WINDOWSNT doesn't need this because it doesn't track mmap'ed
+ regions by hand (see w32heap.c, which uses system APIs for
+ that purpose), and thus doesn't use mmap_regions. */
+ mmap_regions = NULL;
+ mmap_fd = -1;
+#endif
+
+ /* The dumped buffers reference addresses of buffer text
+ recorded by temacs, that cannot be used by the dumped Emacs.
+ We map new memory for their text here.
+
+ Implementation note: the buffers we carry from temacs are:
+ " prin1", "*scratch*", " *Minibuf-0*", "*Messages*", and
+ " *code-conversion-work*". They are created by
+ init_buffer_once and init_window_once (which are not called
+ in the dumped Emacs), and by the first call to coding.c routines. */
+ FOR_EACH_BUFFER (b)
+ {
+ b->text->beg = NULL;
+ enlarge_buffer_text (b, 0);
+ }
+ }
+ else
+ {
+ struct buffer *b;
+
+ /* Only buffers with allocated buffer text should be present at
+ this point in temacs. */
+ FOR_EACH_BUFFER (b)
+ {
+ eassert (b->text->beg != NULL);
+ }
+ }
+#else /* not USE_MMAP_FOR_BUFFERS */
+ /* Avoid compiler warnings. */
+ initialized = initialized;