Commit 15aaf1b5 authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

(malloc_get_state, malloc_set_state): New declarations.

(main): Restore internal malloc state when loading from dumped image.
(Fdump_emacs): Copy internal malloc state for dumping, then free it.
parent d1658221
......@@ -81,6 +81,16 @@ Lisp_Object Vkill_emacs_hook;
on subsequent starts. */
int initialized;
/* Preserves a pointer to the memory allocated that copies that
static data inside glibc's malloc. */
void *malloc_state_ptr;
/* From glibc, a routine that returns a copy of the malloc internal state. */
extern void *malloc_get_state ();
/* From glibc, a routine that overwrites the malloc internal state. */
extern void malloc_set_state ();
/* Variable whose value is symbol giving operating system type. */
Lisp_Object Vsystem_type;
......@@ -486,6 +496,14 @@ main (argc, argv, envp)
__sbrk (1);
if (initialized)
malloc_set_state (malloc_state_ptr);
free (malloc_state_ptr);
sort_args (argc, argv);
if (argmatch (argv, argc, "-version", "--version", 3, NULL, &skip_args))
......@@ -1509,9 +1527,15 @@ and announce itself normally when it is run.")
Meanwhile, my_edata is not valid on Windows. */
memory_warnings (my_edata, malloc_warning);
#endif /* not WINDOWSNT */
malloc_state_ptr = malloc_get_state ();
unexec (XSTRING (filename)->data,
!NILP (symfile) ? XSTRING (symfile)->data : 0, my_edata, 0, 0);
free (malloc_state_ptr);
#endif /* not VMS */
Vpurify_flag = tem;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment