changeset 2994:ec5f23ea6d2e

[xemacs-hg @ 2005-10-14 01:21:57 by ben] add gc percentage threshold to mc-alloc config.h.in, alloc.c, dumper.c, emacs.c, lrecord.h, mc-alloc.c, mc-alloc.h, symbols.c: Rename MC_ALLOC_TYPE_STATS to ALLOC_TYPE_STATS, since (with refactoring) this is not really specific to mc-alloc. Generalize code to implement the GC % threshold for garbage collecting. Rename `lrecord-stats' to `object-memory-usage-stats' (defined when not mc-alloc, too). Rename `memory-usage' to `total-memory-usage' and add `object-memory-usage'. Bump gc_cons_threshold to 2,000,000 (suggestion by Stephen Turnbull). Avoid use of C++ reserved word `catch'. Change address for crash reporting to xemacs-beta@xemacs.org from crashes@xemacs.org. new -> new_ in emacs.c. Turn on _CRT_SECURE_NO_DEPRECATE under Visual C++ to avoid tons of warnings in VC8.
author ben
date Fri, 14 Oct 2005 01:22:01 +0000
parents 49316578f12d
children 574c005d1f5c
files src/ChangeLog src/alloc.c src/config.h.in src/dumper.c src/emacs.c src/lrecord.h src/mc-alloc.c src/mc-alloc.h src/symbols.c
diffstat 9 files changed, 234 insertions(+), 170 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Fri Oct 14 01:02:30 2005 +0000
+++ b/src/ChangeLog	Fri Oct 14 01:22:01 2005 +0000
@@ -1,3 +1,49 @@
+2005-10-13  Ben Wing  <ben@xemacs.org>
+
+	* config.h.in:
+	* alloc.c:
+	* alloc.c (struct):
+	* alloc.c (alloc_lrecord):
+	* alloc.c (noseeum_alloc_lrecord):
+	* alloc.c (finalize_string):
+	* alloc.c (make_uninit_string):
+	* alloc.c (make_string_nocopy):
+	* alloc.c (garbage_collect_1):
+	* alloc.c (object_memory_usage_stats):
+	* alloc.c (HACK_O_MATIC):
+	* alloc.c (Fgarbage_collect):
+	* alloc.c (Ftotal_memory_usage):
+	* alloc.c (recompute_need_to_garbage_collect):
+	* alloc.c (common_init_alloc_early):
+	* alloc.c (syms_of_alloc):
+	* alloc.c (vars_of_alloc):
+	* dumper.c (pdump_load_finish):
+	* emacs.c:
+	* emacs.c (main_1):
+	* emacs.c (shut_down_emacs):
+	* lrecord.h:
+	* lrecord.h (MC_ALLOC_CALL_FINALIZER):
+	* mc-alloc.c (remove_cell):
+	* mc-alloc.h:
+	* symbols.c (init_symbols_once_early):
+	Rename MC_ALLOC_TYPE_STATS to ALLOC_TYPE_STATS, since
+	(with refactoring) this is not really specific to mc-alloc.
+	Generalize code to implement the GC % threshold for garbage
+	collecting.  Rename `lrecord-stats' to `object-memory-usage-stats'
+	(defined when not mc-alloc, too).  Rename `memory-usage' to
+	`total-memory-usage' and add `object-memory-usage'.  Bump
+	gc_cons_threshold to 2,000,000 (suggestion by Stephen Turnbull).
+
+	Avoid use of C++ reserved word `catch'.
+
+	Change address for crash reporting to xemacs-beta@xemacs.org from
+	crashes@xemacs.org.
+
+	new -> new_ in emacs.c.
+
+	Turn on _CRT_SECURE_NO_DEPRECATE under Visual C++ to avoid tons of
+	warnings in VC8.
+
 2005-10-10  Andrey Slusar <anrays@gmail.com>
 
 	* unexelf.c: define `Elfw(type)' for FreeBSD alpha and all _LP64
--- a/src/alloc.c	Fri Oct 14 01:02:30 2005 +0000
+++ b/src/alloc.c	Fri Oct 14 01:22:01 2005 +0000
@@ -1,7 +1,7 @@
 /* Storage allocation and gc for XEmacs Lisp interpreter.
    Copyright (C) 1985-1998 Free Software Foundation, Inc.
    Copyright (C) 1995 Sun Microsystems, Inc.
-   Copyright (C) 1995, 1996, 2001, 2002, 2003, 2004 Ben Wing.
+   Copyright (C) 1995, 1996, 2001, 2002, 2003, 2004, 2005 Ben Wing.
 
 This file is part of XEmacs.
 
@@ -94,6 +94,8 @@
 /* Number of bytes of consing done since the last gc */
 static EMACS_INT consing_since_gc;
 EMACS_UINT total_consing;
+EMACS_INT total_gc_usage;
+int total_gc_usage_set;
 
 int need_to_garbage_collect;
 int need_to_check_c_alloca;
@@ -510,7 +512,7 @@
 }
 #endif /* not MC_ALLOC */
 
-#ifdef MC_ALLOC_TYPE_STATS
+#if defined (MC_ALLOC) && defined (ALLOC_TYPE_STATS)
 static struct
 {
   int instances_in_use;
@@ -579,7 +581,7 @@
 
   DECREMENT_CONS_COUNTER (size);
 }
-#endif /* not MC_ALLOC_TYPE_STATS */
+#endif /* not (MC_ALLOC && ALLOC_TYPE_STATS) */
 
 #ifndef MC_ALLOC
 /* lcrecords are chained together through their "next" field.
@@ -605,9 +607,9 @@
   gc_checking_assert (LRECORD_FREE_P (lheader));
   set_lheader_implementation (lheader, implementation);
   lheader->uid = lrecord_uid_counter++;
-#ifdef MC_ALLOC_TYPE_STATS
+#ifdef ALLOC_TYPE_STATS
   inc_lrecord_stats (size, lheader);
-#endif /* not MC_ALLOC_TYPE_STATS */
+#endif /* ALLOC_TYPE_STATS */
   INCREMENT_CONS_COUNTER (size, implementation->name);
   return lheader;
 }
@@ -627,9 +629,9 @@
   gc_checking_assert (LRECORD_FREE_P (lheader));
   set_lheader_implementation (lheader, implementation);
   lheader->uid = lrecord_uid_counter++;
-#ifdef MC_ALLOC_TYPE_STATS
+#ifdef ALLOC_TYPE_STATS
   inc_lrecord_stats (size, lheader);
-#endif /* not MC_ALLOC_TYPE_STATS */
+#endif /* ALLOC_TYPE_STATS */
   NOSEEUM_INCREMENT_CONS_COUNTER (size, implementation->name);
   return lheader;
 }
@@ -2492,9 +2494,9 @@
     {
       Lisp_String *s = (Lisp_String *) header;
       Bytecount size = s->size_;
-#ifdef MC_ALLOC_TYPE_STATS
+#ifdef ALLOC_TYPE_STATS
       dec_lrecord_string_data_stats (size);
-#endif /* MC_ALLOC_TYPE_STATS */
+#endif /* ALLOC_TYPE_STATS */
       if (BIG_STRING_SIZE_P (size))
 	xfree (s->data_, Ibyte *);
     }
@@ -2614,9 +2616,9 @@
 
 #ifdef MC_ALLOC
   s = alloc_lrecord_type (Lisp_String, &lrecord_string);
-#ifdef MC_ALLOC_TYPE_STATS
+#ifdef ALLOC_TYPE_STATS
   inc_lrecord_string_data_stats (length);
-#endif /* MC_ALLOC_TYPE_STATS */
+#endif /* ALLOC_TYPE_STATS */
 #else /* not MC_ALLOC */
   /* Allocate the string header */
   ALLOCATE_FIXED_TYPE (string, Lisp_String, s);
@@ -3000,9 +3002,9 @@
 
 #ifdef MC_ALLOC
   s = alloc_lrecord_type (Lisp_String, &lrecord_string);
-#ifdef MC_ALLOC_TYPE_STATS
+#ifdef ALLOC_TYPE_STATS
   inc_lrecord_string_data_stats (length);
-#endif /* MC_ALLOC_TYPE_STATS */
+#endif /* ALLOC_TYPE_STATS */
   mcpro (wrap_pointer_1 (s)); /* otherwise nocopy_strings get
 				 collected and static data is tried to
 				 be freed. */
@@ -5525,13 +5527,13 @@
   }
 
   {
-    struct catchtag *catch;
-    for (catch = catchlist; catch; catch = catch->next)
+    struct catchtag *c;
+    for (c = catchlist; c; c = c->next)
       {
-	mark_object (catch->tag);
-	mark_object (catch->val);
-	mark_object (catch->actual_tag);
-	mark_object (catch->backtrace);
+	mark_object (c->tag);
+	mark_object (c->val);
+	mark_object (c->actual_tag);
+	mark_object (c->backtrace);
       }
   }
 
@@ -5667,10 +5669,10 @@
   return;
 }
 
-#ifdef MC_ALLOC
-#ifdef MC_ALLOC_TYPE_STATS
+#ifdef ALLOC_TYPE_STATS
+
 static Lisp_Object
-gc_plist_hack (const Ascbyte *name, int value, Lisp_Object tail)
+gc_plist_hack (const Ascbyte *name, EMACS_INT value, Lisp_Object tail)
 {
   /* C doesn't have local functions (or closures, or GC, or readable syntax,
      or portable numeric datatypes, or bit-vectors, or characters, or
@@ -5678,13 +5680,14 @@
   return cons3 (intern (name), make_int (value), tail);
 }
 
-DEFUN("lrecord-stats", Flrecord_stats, 0, 0 ,"", /*
-Return statistics about lrecords in a property list.
-*/
-       ())
+static Lisp_Object
+object_memory_usage_stats (int set_total_gc_usage)
 {
   Lisp_Object pl = Qnil;
   int i;
+  EMACS_INT tgu_val = 0;
+
+#ifdef MC_ALLOC
   
   for (i = 0; i < (countof (lrecord_implementations_table)
 		   + MODULE_DEFINABLE_TYPE_COUNT); i++)
@@ -5709,6 +5712,7 @@
 	  pl = gc_plist_hack (buf, 
 			      lrecord_stats[i].bytes_in_use,
 			      pl);
+	  tgu_val += lrecord_stats[i].bytes_in_use_including_overhead;
 	  
 	  if (name[len-1] == 's')
 	    sprintf (buf, "%ses-used", name);
@@ -5723,85 +5727,18 @@
 		      lrecord_string_data_bytes_in_use, pl);
   pl = gc_plist_hack ("string-data-used", 
 		      lrecord_string_data_instances_in_use, pl);
-  
-  return pl;
-}
-#endif /* not MC_ALLOC_TYPE_STATS */
-
-DEFUN ("garbage-collect", Fgarbage_collect, 0, 0, "", /*
-Reclaim storage for Lisp objects no longer needed.
-Return info on amount of space in use:
- ((USED-CONSES . STORAGE-CONSES) (USED-SYMS . STORAGE-SYMS)
-  (USED-MARKERS . STORAGE-MARKERS) USED-STRING-CHARS USED-VECTOR-SLOTS
-  PLIST)
-  where `PLIST' is a list of alternating keyword/value pairs providing
-  more detailed information.
-Garbage collection happens automatically if you cons more than
-`gc-cons-threshold' bytes of Lisp data since previous garbage collection.
-*/
-       ())
-{
-  garbage_collect_1 ();
-
-#ifdef MC_ALLOC_TYPE_STATS
-  /* The things we do for backwards-compatibility */
-  return
-    list6 
-    (Fcons (make_int (lrecord_stats[lrecord_type_cons].instances_in_use),
-	    make_int (lrecord_stats[lrecord_type_cons]
-		      .bytes_in_use_including_overhead)),
-     Fcons (make_int (lrecord_stats[lrecord_type_symbol].instances_in_use),
-	    make_int (lrecord_stats[lrecord_type_symbol]
-		      .bytes_in_use_including_overhead)),
-     Fcons (make_int (lrecord_stats[lrecord_type_marker].instances_in_use),
-	    make_int (lrecord_stats[lrecord_type_marker]
-		      .bytes_in_use_including_overhead)),
-     make_int (lrecord_stats[lrecord_type_string]
-	       .bytes_in_use_including_overhead),
-     make_int (lrecord_stats[lrecord_type_vector]
-	       .bytes_in_use_including_overhead),
-     Flrecord_stats ());
-#else /* not MC_ALLOC_TYPE_STATS */
-  return Qnil;
-#endif /* not MC_ALLOC_TYPE_STATS */
-}
+  tgu_val += lrecord_string_data_bytes_in_use_including_overhead;
+
 #else /* not MC_ALLOC */
-/* Debugging aids.  */
-
-static Lisp_Object
-gc_plist_hack (const Ascbyte *name, int value, Lisp_Object tail)
-{
-  /* C doesn't have local functions (or closures, or GC, or readable syntax,
-     or portable numeric datatypes, or bit-vectors, or characters, or
-     arrays, or exceptions, or ...) */
-  return cons3 (intern (name), make_int (value), tail);
-}
 
 #define HACK_O_MATIC(type, name, pl) do {				\
-  int s = 0;								\
+  EMACS_INT s = 0;							\
   struct type##_block *x = current_##type##_block;			\
   while (x) { s += sizeof (*x) + MALLOC_OVERHEAD; x = x->prev; }	\
+  tgu_val += s;							\
   (pl) = gc_plist_hack ((name), s, (pl));				\
 } while (0)
 
-DEFUN ("garbage-collect", Fgarbage_collect, 0, 0, "", /*
-Reclaim storage for Lisp objects no longer needed.
-Return info on amount of space in use:
- ((USED-CONSES . FREE-CONSES) (USED-SYMS . FREE-SYMS)
-  (USED-MARKERS . FREE-MARKERS) USED-STRING-CHARS USED-VECTOR-SLOTS
-  PLIST)
-  where `PLIST' is a list of alternating keyword/value pairs providing
-  more detailed information.
-Garbage collection happens automatically if you cons more than
-`gc-cons-threshold' bytes of Lisp data since previous garbage collection.
-*/
-       ())
-{
-  Lisp_Object pl = Qnil;
-  int i;
-  int gc_count_vector_total_size = 0;
-  garbage_collect_1 ();
-
   for (i = 0; i < lrecord_type_count; i++)
     {
       if (lcrecord_stats[i].bytes_in_use != 0
@@ -5811,13 +5748,10 @@
           char buf [255];
           const char *name = lrecord_implementations_table[i]->name;
 	  int len = strlen (name);
-	  /* save this for the FSFmacs-compatible part of the summary */
-	  if (i == lrecord_type_vector)
-	    gc_count_vector_total_size =
-	      lcrecord_stats[i].bytes_in_use + lcrecord_stats[i].bytes_freed;
 
           sprintf (buf, "%s-storage", name);
           pl = gc_plist_hack (buf, lcrecord_stats[i].bytes_in_use, pl);
+	  tgu_val += lcrecord_stats[i].bytes_in_use;
 	  /* Okay, simple pluralization check for `symbol-value-varalias' */
 	  if (name[len-1] == 's')
 	    sprintf (buf, "%ses-freed", name);
@@ -5895,7 +5829,70 @@
   pl = gc_plist_hack ("conses-free", gc_count_num_cons_freelist, pl);
   pl = gc_plist_hack ("conses-used", gc_count_num_cons_in_use, pl);
 
+#undef HACK_O_MATIC
+
+#endif /* MC_ALLOC */
+
+  if (set_total_gc_usage)
+    {
+      total_gc_usage = tgu_val;
+      total_gc_usage_set = 1;
+    }
+
+  return pl;
+}
+
+DEFUN("object-memory-usage-stats", Fobject_memory_usage_stats, 0, 0 ,"", /*
+Return statistics about memory usage of Lisp objects.
+*/
+       ())
+{
+  return object_memory_usage_stats (0);
+}
+
+#endif /* ALLOC_TYPE_STATS */
+
+/* Debugging aids.  */
+
+DEFUN ("garbage-collect", Fgarbage_collect, 0, 0, "", /*
+Reclaim storage for Lisp objects no longer needed.
+Return info on amount of space in use:
+ ((USED-CONSES . FREE-CONSES) (USED-SYMS . FREE-SYMS)
+  (USED-MARKERS . FREE-MARKERS) USED-STRING-CHARS USED-VECTOR-SLOTS
+  PLIST)
+  where `PLIST' is a list of alternating keyword/value pairs providing
+  more detailed information.
+Garbage collection happens automatically if you cons more than
+`gc-cons-threshold' bytes of Lisp data since previous garbage collection.
+*/
+       ())
+{
+  /* Record total usage for purposes of determining next GC */
+  garbage_collect_1 ();
+
+  /* This will get set to 1, and total_gc_usage computed, as part of the
+     call to object_memory_usage_stats() -- if ALLOC_TYPE_STATS is enabled. */
+  total_gc_usage_set = 0;
+#ifdef ALLOC_TYPE_STATS
   /* The things we do for backwards-compatibility */
+#ifdef MC_ALLOC
+  return
+    list6 
+    (Fcons (make_int (lrecord_stats[lrecord_type_cons].instances_in_use),
+	    make_int (lrecord_stats[lrecord_type_cons]
+		      .bytes_in_use_including_overhead)),
+     Fcons (make_int (lrecord_stats[lrecord_type_symbol].instances_in_use),
+	    make_int (lrecord_stats[lrecord_type_symbol]
+		      .bytes_in_use_including_overhead)),
+     Fcons (make_int (lrecord_stats[lrecord_type_marker].instances_in_use),
+	    make_int (lrecord_stats[lrecord_type_marker]
+		      .bytes_in_use_including_overhead)),
+     make_int (lrecord_stats[lrecord_type_string]
+	       .bytes_in_use_including_overhead),
+     make_int (lrecord_stats[lrecord_type_vector]
+	       .bytes_in_use_including_overhead),
+     object_memory_usage_stats (1));
+#else /* not MC_ALLOC */
   return
     list6 (Fcons (make_int (gc_count_num_cons_in_use),
 		  make_int (gc_count_num_cons_freelist)),
@@ -5904,11 +5901,14 @@
 	   Fcons (make_int (gc_count_num_marker_in_use),
 		  make_int (gc_count_num_marker_freelist)),
 	   make_int (gc_count_string_total_size),
-	   make_int (gc_count_vector_total_size),
-	   pl);
-}
-#undef HACK_O_MATIC
+	   make_int (lcrecord_stats[lrecord_type_vector].bytes_in_use +
+		     lcrecord_stats[lrecord_type_vector].bytes_freed),
+	   object_memory_usage_stats (1));
 #endif /* not MC_ALLOC */
+#else /* not ALLOC_TYPE_STATS */
+  return Qnil;
+#endif /* ALLOC_TYPE_STATS */
+}
 
 DEFUN ("consing-since-gc", Fconsing_since_gc, 0, 0, "", /*
 Return the number of bytes consed since the last garbage collection.
@@ -5934,15 +5934,30 @@
 }
 #endif
 
-DEFUN ("memory-usage", Fmemory_usage, 0, 0, 0, /*
+DEFUN ("total-memory-usage", Ftotal_memory_usage, 0, 0, 0, /*
 Return the total number of bytes used by the data segment in XEmacs.
 This may be helpful in debugging XEmacs's memory usage.
+NOTE: This may or may not be accurate!  It is hard to determine this
+value in a system-independent fashion.  On Windows, for example, the
+returned number tends to be much greater than reality.
 */
        ())
 {
   return make_int (total_data_usage ());
 }
 
+#ifdef ALLOC_TYPE_STATS
+DEFUN ("object-memory-usage", Fobject_memory_usage, 0, 0, 0, /*
+Return total number of bytes used for object storage in XEmacs.
+This may be helpful in debugging XEmacs's memory usage.
+See also `consing-since-gc' and `object-memory-usage-stats'.
+*/
+       ())
+{
+  return make_int (total_gc_usage + consing_since_gc);
+}
+#endif /* ALLOC_TYPE_STATS */
+
 void
 recompute_funcall_allocation_flag (void)
 {
@@ -5961,11 +5976,15 @@
   else
     need_to_garbage_collect =
       (consing_since_gc > gc_cons_threshold
+       &&
 #if 0 /* #### implement this better */
-       &&
        (100 * consing_since_gc) / total_data_usage () >=
        gc_cons_percentage
-#endif /* 0 */
+#else
+       (!total_gc_usage_set ||
+	(100 * consing_since_gc) / total_gc_usage >=
+	gc_cons_percentage)
+#endif
        );
   recompute_funcall_allocation_flag ();
 }
@@ -6216,13 +6235,12 @@
   funcall_alloca_count = 0;
 
 #if 1
-  gc_cons_threshold = 500000; /* XEmacs change */
+  gc_cons_threshold = 2000000; /* XEmacs change */
 #else
   gc_cons_threshold = 15000; /* debugging */
 #endif
-  gc_cons_percentage = 0; /* #### 20; Don't have an accurate measure of
-			     memory usage on Windows; not verified on other
-			     systems */
+  gc_cons_percentage = 40; /* #### what is optimal? */
+  total_gc_usage_set = 0;
   lrecord_uid_counter = 259;
 #ifndef MC_ALLOC
   debug_string_purity = 0;
@@ -6347,14 +6365,15 @@
   DEFSUBR (Fmake_symbol);
   DEFSUBR (Fmake_marker);
   DEFSUBR (Fpurecopy);
-#ifdef MC_ALLOC_TYPE_STATS
-  DEFSUBR (Flrecord_stats);
-#endif /* MC_ALLOC_TYPE_STATS */
+#ifdef ALLOC_TYPE_STATS
+  DEFSUBR (Fobject_memory_usage_stats);
+  DEFSUBR (Fobject_memory_usage);
+#endif /* ALLOC_TYPE_STATS */
   DEFSUBR (Fgarbage_collect);
 #if 0
   DEFSUBR (Fmemory_limit);
 #endif
-  DEFSUBR (Fmemory_usage);
+  DEFSUBR (Ftotal_memory_usage);
   DEFSUBR (Fconsing_since_gc);
 }
 
@@ -6386,26 +6405,22 @@
 will be unusable!  You almost certainly won't have the patience to wait
 long enough to be able to set it back.
  
-See also `consing-since-gc'.
+See also `consing-since-gc' and `gc-cons-percentage'.
 */ );
 
   DEFVAR_INT ("gc-cons-percentage", &gc_cons_percentage /*
 *Percentage of memory allocated between garbage collections.
 
 Garbage collection will happen if this percentage of the total amount of
-memory used for data has been allocated since the last garbage collection.
-However, it will not happen if less than `gc-cons-threshold' bytes have
-been allocated -- this sets an absolute minimum in case very little data
-has been allocated or the percentage is set very low.  Set this to 0 to
-have garbage collection always happen after `gc-cons-threshold' bytes have
-been allocated, regardless of current memory usage.
-
-Garbage collection happens automatically when `eval' or `funcall' are
-called.  (Note that `funcall' is called implicitly as part of evaluation.)
-By binding this temporarily to a large number, you can effectively
-prevent garbage collection during a part of the program.
-
-See also `consing-since-gc'.
+memory used for data (see `lisp-object-memory-usage') has been allocated
+since the last garbage collection.  However, it will not happen if less
+than `gc-cons-threshold' bytes have been allocated -- this sets an absolute
+minimum in case very little data has been allocated or the percentage is
+set very low.  Set this to 0 to have garbage collection always happen after
+`gc-cons-threshold' bytes have been allocated, regardless of current memory
+usage.
+
+See also `consing-since-gc' and `gc-cons-threshold'.
 */ );
 
 #ifdef DEBUG_XEMACS
--- a/src/config.h.in	Fri Oct 14 01:02:30 2005 +0000
+++ b/src/config.h.in	Fri Oct 14 01:22:01 2005 +0000
@@ -1,6 +1,6 @@
 /* XEmacs site configuration template file.  -*- C -*-
    Copyright (C) 1986, 1991-1994, 1998, 1999 Free Software Foundation, Inc.
-   Copyright (C) 2000, 2001, 2002, 2004 Ben Wing.
+   Copyright (C) 2000, 2001, 2002, 2004, 2005 Ben Wing.
 
 This file is part of XEmacs.
 
@@ -815,6 +815,13 @@
 
 #endif /* WIN32_NO_CONFIGURE */
 
+#ifdef _MSC_VER
+/* Turn off tons of C4996 warnings in VC 8 about standard functions being
+   "deprecated" in favor of Microsoft-specific "secure" ones (!)
+   This must go *before* the inclusion of any system files. */
+#define _CRT_SECURE_NO_DEPRECATE
+#endif
+
 /* alloca twiddling.
    Because we might be #including alloca.h here, feature test macros
    such as _XOPEN_SOURCE must be defined above.
@@ -909,6 +916,16 @@
 #define SYSTEM_MALLOC
 #endif
 
+/* This enables type based information (updated during gc). The output
+   is used by show-memory-usage to print memory information for each
+   type. Since the new allocator does not distinguish between types
+   anymore, this functionality is additionally implemented and
+   consumes a lot of time.  That is why this functionality can be
+   disabled; for the moment, we keep it enabled. */
+#if !defined (MC_ALLOC) || 1
+# define ALLOC_TYPE_STATS 1
+#endif
+
 /* Define the return type of signal handlers if the s/xxx.h file
    did not already do so. */
 #define RETSIGTYPE void
--- a/src/dumper.c	Fri Oct 14 01:02:30 2005 +0000
+++ b/src/dumper.c	Fri Oct 14 01:22:01 2005 +0000
@@ -2164,7 +2164,7 @@
 		  if (count == 2)
 		    {
 		      mc_addr = (Rawbyte *) mc_alloc (real_size);
-#ifdef MC_ALLOC_TYPE_STATS
+#ifdef ALLOC_TYPE_STATS
 		      inc_lrecord_stats (real_size, 
 					 (const struct lrecord_header *) 
 					 ((char *) rdata + delta));
@@ -2173,7 +2173,7 @@
 			  == lrecord_type_string)
 			inc_lrecord_string_data_stats 
 			  (((Lisp_String *) ((char *) rdata + delta))->size_);
-#endif /* not MC_ALLOC_TYPE_STATS */
+#endif /* ALLOC_TYPE_STATS */
 		    }
 		  else
 		    mc_addr = (Rawbyte *) xmalloc_and_zero (real_size);
--- a/src/emacs.c	Fri Oct 14 01:02:30 2005 +0000
+++ b/src/emacs.c	Fri Oct 14 01:22:01 2005 +0000
@@ -919,9 +919,9 @@
       if (!restart)
 	{
 	  init_mc_allocator ();
-#ifdef MC_ALLOC_TYPE_STATS
+#ifdef ALLOC_TYPE_STATS
 	  init_lrecord_stats ();
-#endif /* not MC_ALLOC_TYPE_STATS */
+#endif /* ALLOC_TYPE_STATS */
 	}
     }
 #endif /* MC_ALLOC */
@@ -1217,16 +1217,16 @@
 	 This requires inserting a new element into argv.  */
       if (dpy != 0 && skip_args - count_before == 1)
 	{
-	  Wexttext **new = xnew_array (Wexttext *, argc + 2);
+	  Wexttext **new_ = xnew_array (Wexttext *, argc + 2);
 	  int j;
 
 	  for (j = 0; j < count_before + 1; j++)
-	    new[j] = argv[j];
-	  new[count_before + 1] = WEXTSTRING ("-d");
-	  new[count_before + 2] = dpy;
+	    new_[j] = argv[j];
+	  new_[count_before + 1] = WEXTSTRING ("-d");
+	  new_[count_before + 2] = dpy;
 	  for (j = count_before + 2; j <argc; j++)
-	    new[j + 1] = argv[j];
-	  argv = new;
+	    new_[j + 1] = argv[j];
+	  argv = new_;
 	  argc++;
 	}
       /* Change --display to -d, when its arg is separate.  */
@@ -2913,7 +2913,7 @@
 Do not call this.  It will reinitialize your XEmacs.  You'll be sorry.
 */
 /* If this function is called from startup.el, it will be possible to run
-   temacs as an editor using 'temacs -batch -l loadup.el run-temacs', instead
+   temacs as an editor using `temacs -batch -l loadup.el run-temacs', instead
    of having to dump an emacs and then run that (when debugging emacs itself,
    this can be much faster)). [Actually, the speed difference isn't that
    much as long as your filesystem is local, and you don't end up with
@@ -3472,17 +3472,17 @@
 "the crash anyway.\n\n"
 #ifdef INFODOCK
 "Please report this bug by selecting `Report-Bug' in the InfoDock menu, or\n"
-"(last resort) by emailing `crashes@xemacs.org' -- note that this is for XEmacs\n"
-"in general, not just Infodock."
+"(last resort) by emailing `xemacs-beta@xemacs.org' -- note that this is for\n"
+"XEmacs in general, not just Infodock."
 #else
 "Please report this bug by invoking M-x report-emacs-bug, or by selecting\n"
 "`Send Bug Report' from the Help menu.  If that won't work, send ordinary\n"
-"email to `crashes@xemacs.org'."
-#endif
-"  *MAKE SURE* to include this entire output\n"
-"from this crash, especially including the Lisp backtrace, as well as the\n"
-"XEmacs configuration from M-x describe-installation (or equivalently, the\n"
-"file `Installation' in the top of the build tree).\n"
+"email to `xemacs-beta@xemacs.org'."
+#endif
+"  *MAKE SURE* to include this entire\n"
+"output from this crash, especially including the Lisp backtrace, as well as\n"
+"the XEmacs configuration from M-x describe-installation (or equivalently,\n"
+"the file `Installation' in the top of the build tree).\n"
 #ifdef _MSC_VER
 "\n"
 "If you are fortunate enough to have some sort of debugging aid installed\n"
--- a/src/lrecord.h	Fri Oct 14 01:02:30 2005 +0000
+++ b/src/lrecord.h	Fri Oct 14 01:22:01 2005 +0000
@@ -376,18 +376,16 @@
 
 #ifdef MC_ALLOC
 #include "mc-alloc.h"
-#endif /* MC_ALLOC */
 
-#ifdef MC_ALLOC_TYPE_STATS
+#ifdef ALLOC_TYPE_STATS
 void init_lrecord_stats (void);
 void inc_lrecord_string_data_stats (Bytecount size);
 void dec_lrecord_string_data_stats (Bytecount size);
 void inc_lrecord_stats (Bytecount size, const struct lrecord_header *h);
 void dec_lrecord_stats (Bytecount size_including_overhead, 
 			const struct lrecord_header *h);
-#endif /* MC_ALLOC_TYPE_STATS */
+#endif /* ALLOC_TYPE_STATS */
 
-#ifdef MC_ALLOC
 /* Tell mc-alloc how to call a finalizer. */
 #define MC_ALLOC_CALL_FINALIZER(ptr)					\
 {									\
--- a/src/mc-alloc.c	Fri Oct 14 01:02:30 2005 +0000
+++ b/src/mc-alloc.c	Fri Oct 14 01:22:01 2005 +0000
@@ -1486,10 +1486,10 @@
 #endif
   if (PH_ON_USED_LIST_P (ph)) 
     {
-#ifdef MC_ALLOC_TYPE_STATS
+#ifdef ALLOC_TYPE_STATS
       dec_lrecord_stats (PH_CELL_SIZE (ph), 
 			 (const struct lrecord_header *) ptr);
-#endif /* MC_ALLOC_TYPE_STATS */
+#endif /* ALLOC_TYPE_STATS */
 #ifdef ERROR_CHECK_GC
       assert (!LRECORD_FREE_P (ptr));
       deadbeef_memory (ptr, PH_CELL_SIZE (ph));
--- a/src/mc-alloc.h	Fri Oct 14 01:02:30 2005 +0000
+++ b/src/mc-alloc.h	Fri Oct 14 01:22:01 2005 +0000
@@ -35,18 +35,6 @@
 # endif
 #endif /* MALLOC_OVERHEAD */
 
-
-/* This enables type based information (updated during gc). The output
-   is used by show-memory-usage to print memory information for each
-   type. Since the new allocator does not distinguish between types
-   anymore, this functionality is additionally implemented and
-   consumes a lot of time.  That is why it is kept conditioned on a
-   separate flag called MC_ALLOC_TYPE_STATS. */
-#if 1 
-# define MC_ALLOC_TYPE_STATS 1 
-#endif
-
-
 /*--- prototypes -------------------------------------------------------*/
 
 BEGIN_C_DECLS
--- a/src/symbols.c	Fri Oct 14 01:02:30 2005 +0000
+++ b/src/symbols.c	Fri Oct 14 01:22:01 2005 +0000
@@ -3331,10 +3331,10 @@
     mcpro (wrap_pointer_1 (tem));
     tem->value = 0;
     tem->type = SYMVAL_UNBOUND_MARKER;
-#ifdef MC_ALLOC_TYPE_STATS
+#ifdef ALLOC_TYPE_STATS
     inc_lrecord_stats (sizeof (struct symbol_value_magic), 
 		       (const struct lrecord_header *) tem);
-#endif /* not MC_ALLOC_TYPE_STATS */
+#endif /* ALLOC_TYPE_STATS */
 #else /* not MC_ALLOC */
     const struct symbol_value_magic *tem = &guts_of_unbound_marker;
 #endif /* not MC_ALLOC */