# endif
#endif /* HAVE_BDWGC */
-#if !defined (SYSTEM_MALLOC) && !defined (DOUG_LEA_MALLOC)
-extern void *(*__malloc_hook) (size_t);
-extern void *(*__realloc_hook) (void *, size_t);
-extern void (*__free_hook) (void *);
-#endif /* not SYSTEM_MALLOC && not DOUG_LEA_MALLOC */
-
/* Command line args from shell, as list of strings */
Lisp_Object Vcommand_line_args;
on subsequent starts. */
int initialized;
-#ifdef DOUG_LEA_MALLOC
+#ifdef HAVE_GLIBC
# include <malloc.h>
/* Preserves a pointer to the memory allocated that copies that
static data inside glibc's malloc. */
static void *malloc_state_ptr;
-#endif /* DOUG_LEA_MALLOC */
+#endif /* HAVE_GLIBC */
# ifdef REL_ALLOC
void r_alloc_reinit(void);
extern int malloc_cookie;
#endif
-#if (!defined (SYSTEM_MALLOC) && !defined (HAVE_LIBMCHECK) \
- && !defined (DOUG_LEA_MALLOC))
- /* Make sure that any libraries we link against haven't installed a
- hook for a gmalloc of a potentially incompatible version. */
- /* If we're using libmcheck, the hooks have already been initialized, */
- /* don't touch them. -slb */
- __malloc_hook = NULL;
- __realloc_hook = NULL;
- __free_hook = NULL;
-#endif /* not SYSTEM_MALLOC or HAVE_LIBMCHECK or DOUG_LEA_MALLOC */
-
noninteractive = 0;
inhibit_non_essential_printing_operations = 1;
stderr_out("malloc jumpstart failed!\n");
#endif /* NeXT */
- /*
- #if defined (GNU_MALLOC) && \
- defined (ERROR_CHECK_MALLOC) && \
- !defined (HAVE_LIBMCHECK)
- */
-#if defined(LOSING_GCC_DESTRUCTOR_FREE_BUG)
- /* Prior to SXEmacs 21, this was `#if 0'ed out. */
- /* I'm enabling this because it is the only reliable way I've found to */
- /* prevent a very annoying problem where GCC will attempt to free(3) */
- /* memory at exit() and cause a coredump. */
-#if 0
- init_free_hook();
-#endif
-#endif
-
sort_args(argc, argv);
#if defined(_SCO_DS)
#if defined (HAVE_MMAP) && defined (REL_ALLOC)
/* ralloc can only be used if using the GNU memory allocator. */
init_ralloc();
-#elif defined (REL_ALLOC) && !defined(DOUG_LEA_MALLOC)
+#elif defined (REL_ALLOC) && !defined(HAVE_GLIBC)
if (initialized)
init_ralloc();
#endif
syms_of_process();
#endif
syms_of_profile();
-#if defined (HAVE_MMAP) && defined (REL_ALLOC) && !defined(DOUG_LEA_MALLOC)
+#if defined (HAVE_MMAP) && defined (REL_ALLOC) && !defined(HAVE_GLIBC)
syms_of_ralloc();
#endif /* HAVE_MMAP && REL_ALLOC */
syms_of_rangetab();
SYMS_MACHINE;
#endif
- /*
- #if defined (GNU_MALLOC) && \
- defined (ERROR_CHECK_MALLOC) && \
- !defined (HAVE_LIBMCHECK)
- */
- /* Prior to SXEmacs 21, this was `#if 0'ed out. -slb */
-#if defined (LOSING_GCC_DESTRUCTOR_FREE_BUG)
- syms_of_free_hook();
-#endif
-
#ifdef SUNPRO
syms_of_sunpro();
#endif
#endif
vars_of_profile();
-#if defined (HAVE_MMAP) && defined (REL_ALLOC) && !defined(DOUG_LEA_MALLOC)
+#if defined (HAVE_MMAP) && defined (REL_ALLOC) && !defined(HAVE_GLIBC)
vars_of_ralloc();
#endif /* HAVE_MMAP && REL_ALLOC */
vars_of_redisplay();
init_bdwgc();
if (!initialized) {
-#ifdef DOUG_LEA_MALLOC
+#ifdef HAVE_GLIBC
if (mallopt(M_MMAP_MAX, 0) != 1)
abort();
#endif
run_time_remap(argv[0]);
#endif
-#ifdef DOUG_LEA_MALLOC
+#ifdef HAVE_GLIBC
if (initialized && (malloc_state_ptr != NULL)) {
int rc = malloc_set_state(malloc_state_ptr);
if (rc != 0) {
/* mmap works in glibc-2.1, glibc-2.0 (Non-Mule only)
* and Linux libc5 */
#if (defined(__GLIBC__) && __GLIBC_MINOR__ >= 1) || \
- defined(_NO_MALLOC_WARNING_) || \
- (defined(__GLIBC__) && __GLIBC_MINOR__ < 1 && !defined(MULE)) || \
- defined(DEBUG_DOUG_LEA_MALLOC)
+ defined(HAVE_MALLOC_WARNING) || \
+ (defined(__GLIBC__) && __GLIBC_MINOR__ < 1 && !defined(MULE))
if (mallopt(M_MMAP_MAX, 0) != 1)
abort();
#endif
r_alloc_reinit();
#endif
}
- #endif /* DOUG_LEA_MALLOC */
+#endif /* HAVE_GLIBC */
run_temacs_argc = -1;
}
\f
-/* Dumping apparently isn't supported by versions of GCC >= 2.8. */
-/* The following needs conditionalization on whether either SXEmacs or */
-/* various system shared libraries have been built and linked with */
-/* GCC >= 2.8. -slb */
-#if defined(GNU_MALLOC)
-#if defined(HAVE_MORECORE_HOOK)
-static void voodoo_free_hook(void *mem)
-{
- /* If it no longer works, we'll know about it. For now there is really no
- good alternatic. Shut the warning off
- */
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-
- /* Disable all calls to free() when SXEmacs is exiting and it doesn't */
- /* matter. */
- __free_hook =
-#if defined __GNUC__ || defined __INTEL_COMPILER
-/* prototype of __free_hook varies with glibc version */
- (__typeof__(__free_hook))
-#endif
- voodoo_free_hook;
-#pragma GCC diagnostic pop
-}
-#endif
-#endif /* GNU_MALLOC */
DEFUN("kill-emacs", Fkill_emacs, 0, 1, "P", /*
Exit the SXEmacs job and kill it. Ask for confirmation, without argument.
shut_down_emacs(0, STRINGP(arg) ? arg : Qnil, 0);
-#if defined(GNU_MALLOC)
-#if defined(HAVE_MORECORE_HOOK)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
- __free_hook =
-#if defined __GNUC__ || defined __INTEL_COMPILER
-/* prototype of __free_hook varies with glibc version */
- (__typeof__(__free_hook))
-#endif
- voodoo_free_hook;
-#pragma GCC diagnostic pop
-#endif
-#endif
-
exit(INTP(arg) ? XINT(arg) : 0);
/* NOTREACHED */
return Qnil; /* I'm sick of the compiler warning */
extern char my_edata[];
#endif
-extern void disable_free_hook(void);
-
DEFUN("dump-emacs", Fdump_emacs, 2, 2, 0, /*
Dump current state of SXEmacs into executable file FILENAME.
Take symbols from SYMFILE (presumably the file you executed to run SXEmacs).
Vcommand_line_args = Qnil;
#endif
-#ifdef FREE_CHECKING
- Freally_free(Qnil);
-
- /* When we're dumping, we can't use the debugging free() */
- disable_free_hook();
-#endif
-
CHECK_STRING(filename);
filename = Fexpand_file_name(filename, Qnil);
if (!NILP(symfile)) {
pdump(filename_ext);
#else
-#ifdef DOUG_LEA_MALLOC
+#ifdef HAVE_GLIBC
malloc_state_ptr = malloc_get_state();
#endif
/* here we break our rule that the filename conversion should
conversion is applied everywhere. Don't worry about memory
leakage because this call only happens once. */
unexec(filename_ext, symfile_ext, (uintptr_t) my_edata, 0, 0);
-#ifdef DOUG_LEA_MALLOC
+#ifdef HAVE_GLIBC
free(malloc_state_ptr);
#endif
#endif /* not PDUMP */