]> git.eshelyaron.com Git - emacs.git/commitdiff
(GC_collect_start_callback, GC_collect_end_callback): New.
authorDave Love <fx@gnu.org>
Fri, 6 Jun 2003 09:43:30 +0000 (09:43 +0000)
committerDave Love <fx@gnu.org>
Fri, 6 Jun 2003 09:43:30 +0000 (09:43 +0000)
(stop_func): Use them.

gc/alloc.c

index 4cb7a4c71077c734294eb2d36c1fdf714c0c808e..a6cc40d7e51e907a30c7da220031bea88226eace 100644 (file)
@@ -17,7 +17,7 @@
 
 
 # include "private/gc_priv.h"
-
+#include <malloc.h>
 # include <stdio.h>
 # if !defined(MACOS) && !defined(MSWINCE)
 #   include <signal.h>
@@ -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);
 }