diff options
| author | Richard M. Stallman | 1997-04-09 04:00:10 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1997-04-09 04:00:10 +0000 |
| commit | 15aaf1b5d2d579128daf53cc026d9e05dca0bbef (patch) | |
| tree | d4c970807b4d75c072f86fc3a63da3781f930c9e /src | |
| parent | d165822189d59c8272052873803734de19bb929c (diff) | |
| download | emacs-15aaf1b5d2d579128daf53cc026d9e05dca0bbef.tar.gz emacs-15aaf1b5d2d579128daf53cc026d9e05dca0bbef.zip | |
(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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/emacs.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/emacs.c b/src/emacs.c index 763b778e0c9..a8bd976e734 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -81,6 +81,16 @@ Lisp_Object Vkill_emacs_hook; | |||
| 81 | on subsequent starts. */ | 81 | on subsequent starts. */ |
| 82 | int initialized; | 82 | int initialized; |
| 83 | 83 | ||
| 84 | #ifdef DOUG_LEA_MALLOC | ||
| 85 | /* Preserves a pointer to the memory allocated that copies that | ||
| 86 | static data inside glibc's malloc. */ | ||
| 87 | void *malloc_state_ptr; | ||
| 88 | /* From glibc, a routine that returns a copy of the malloc internal state. */ | ||
| 89 | extern void *malloc_get_state (); | ||
| 90 | /* From glibc, a routine that overwrites the malloc internal state. */ | ||
| 91 | extern void malloc_set_state (); | ||
| 92 | #endif | ||
| 93 | |||
| 84 | /* Variable whose value is symbol giving operating system type. */ | 94 | /* Variable whose value is symbol giving operating system type. */ |
| 85 | Lisp_Object Vsystem_type; | 95 | Lisp_Object Vsystem_type; |
| 86 | 96 | ||
| @@ -486,6 +496,14 @@ main (argc, argv, envp) | |||
| 486 | __sbrk (1); | 496 | __sbrk (1); |
| 487 | #endif | 497 | #endif |
| 488 | 498 | ||
| 499 | #ifdef DOUG_LEA_MALLOC | ||
| 500 | if (initialized) | ||
| 501 | { | ||
| 502 | malloc_set_state (malloc_state_ptr); | ||
| 503 | free (malloc_state_ptr); | ||
| 504 | } | ||
| 505 | #endif | ||
| 506 | |||
| 489 | sort_args (argc, argv); | 507 | sort_args (argc, argv); |
| 490 | 508 | ||
| 491 | if (argmatch (argv, argc, "-version", "--version", 3, NULL, &skip_args)) | 509 | if (argmatch (argv, argc, "-version", "--version", 3, NULL, &skip_args)) |
| @@ -1510,8 +1528,14 @@ and announce itself normally when it is run.") | |||
| 1510 | memory_warnings (my_edata, malloc_warning); | 1528 | memory_warnings (my_edata, malloc_warning); |
| 1511 | #endif /* not WINDOWSNT */ | 1529 | #endif /* not WINDOWSNT */ |
| 1512 | #endif | 1530 | #endif |
| 1531 | #ifdef DOUG_LEA_MALLOC | ||
| 1532 | malloc_state_ptr = malloc_get_state (); | ||
| 1533 | #endif | ||
| 1513 | unexec (XSTRING (filename)->data, | 1534 | unexec (XSTRING (filename)->data, |
| 1514 | !NILP (symfile) ? XSTRING (symfile)->data : 0, my_edata, 0, 0); | 1535 | !NILP (symfile) ? XSTRING (symfile)->data : 0, my_edata, 0, 0); |
| 1536 | #ifdef DOUG_LEA_MALLOC | ||
| 1537 | free (malloc_state_ptr); | ||
| 1538 | #endif | ||
| 1515 | #endif /* not VMS */ | 1539 | #endif /* not VMS */ |
| 1516 | 1540 | ||
| 1517 | Vpurify_flag = tem; | 1541 | Vpurify_flag = tem; |