From: Dave Love Date: Fri, 6 Jun 2003 09:43:30 +0000 (+0000) Subject: (GC_collect_start_callback, GC_collect_end_callback): New. X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=22356f48201802bd3db48aff06a3602b6c8f8a7f;p=emacs.git (GC_collect_start_callback, GC_collect_end_callback): New. (stop_func): Use them. --- diff --git a/gc/alloc.c b/gc/alloc.c index 4cb7a4c7107..a6cc40d7e51 100644 --- a/gc/alloc.c +++ b/gc/alloc.c @@ -17,7 +17,7 @@ # include "private/gc_priv.h" - +#include # include # if !defined(MACOS) && !defined(MSWINCE) # include @@ -135,6 +135,17 @@ int GC_n_attempts = 0; /* Number of attempts at finishing */ } #endif /* !SMALL_CONFIG */ +#if 0 +void* callocx (size_t n, size_t size) +{ + void *val; + mallopt (M_MMAP_MAX, 0); + val = calloc (n, size); + mallopt (M_MMAP_MAX, 100000000); + return val; +} +#endif + /* Return the minimum number of words that must be allocated between */ /* collections to amortize the collection cost. */ static word min_words_allocd() @@ -297,6 +308,9 @@ void GC_maybe_gc() } +void (*GC_collect_start_callback)GC_PROTO((void)) = NULL; +void (*GC_collect_end_callback)GC_PROTO((void)) = NULL; + /* * Stop the world garbage collection. Assumes lock held, signals disabled. * If stop_func is not GC_never_stop_func, then abort if stop_func returns TRUE. @@ -309,6 +323,8 @@ GC_stop_func stop_func; CLOCK_TYPE start_time, current_time; # endif if (GC_dont_gc) return FALSE; + if (GC_collect_start_callback) + GC_collect_start_callback(); if (GC_incremental && GC_collection_in_progress()) { # ifdef CONDPRINT if (GC_print_stats) { @@ -371,6 +387,8 @@ GC_stop_func stop_func; MS_TIME_DIFF(current_time,start_time)); } # endif + if (GC_collect_end_callback) + GC_collect_end_callback(); return(TRUE); }