[Gc] My old suggested minor changes

Ivan Maidanski ivmai at mail.ru
Sun Nov 9 05:23:53 PST 2008


Hi!

I've decided to re-send two my old (early Sept) minor suggested changes (they were originally sent to Boehm's mail, not this mailing list).

First fix is for GC_set_free_space_divisor() comment ("gc.h" file):
- passing -1 (or ~0, but not zero) to this func does not change old value (this is consistent with GC_set_java_finalization(), GC_set_dont_expand(), GC_set_no_dls(), GC_set_max_retries(), GC_set_dont_precollect()).

The second thing is a suggestion of two env vas. To my opinion, the GC lacks two environment variables for better self tuning at run-time:
- GC_FREE_SPACE_DIVISOR=<n>, where <n> is a positive value for GC_free_space_divisor to set at start-up;
- GC_DISABLE_INCREMENTAL - to ignore explicit GC_enable_incremental() calls (useful when an application calls GC_enable_incremental() unconditionally (like test.c)).

The attached patch is a diff against current CVS.

Also another suggestion:
there is a dozen of C files (add_gc_prefix.c, AmigaOS.c, gcname.c, if_mach.c, if_not_there.c, MacOS.c, msvc_dbg.c, setjmp_t.c, threadlibs.c) that are not a part of libgc.a (or gc.lib) - it would be convenient (eg, typing "*.c" for manual builds) to have these files moved to some other sub-folder (eg., "misc" or "extra"). In case of approval, I could make necessary patches for existing scripts (affected by such a movement).

Bye.
-------------- next part --------------
diff -ru CVS/bdwgc/include/gc.h updated/bdwgc/include/gc.h
--- CVS/bdwgc/include/gc.h	2008-11-07 03:53:21.000000000 +0300
+++ updated/bdwgc/include/gc.h	2008-11-09 14:59:24.984572700 +0300
@@ -837,7 +837,7 @@
 GC_API GC_word GC_CALL GC_set_free_space_divisor(GC_word value);
     /* Set free_space_divisor.  See above for definition.	*/
     /* Returns old value.					*/
-    /* With zero argument, nothing is changed, but old value is	*/
+    /* With -1 argument, nothing is changed, but old value is	*/
     /* returned.  (Only true for GC7.2+)		        */
 	
 /* The following is intended to be used by a higher level	*/
diff -ru CVS/bdwgc/misc.c updated/bdwgc/misc.c
--- CVS/bdwgc/misc.c	2008-11-08 03:29:55.000000000 +0300
+++ updated/bdwgc/misc.c	2008-11-09 15:01:03.386477700 +0300
@@ -589,6 +589,14 @@
         }
       }
     }
+    {
+	char * space_divisor_string = GETENV("GC_FREE_SPACE_DIVISOR");
+	if (space_divisor_string != NULL) {
+	  int space_divisor = atoi(space_divisor_string);
+	  if (space_divisor > 0)
+	    GC_free_space_divisor = (GC_word)space_divisor;
+	}
+    }
     maybe_install_looping_handler();
     /* Adjust normal object descriptor for extra allocation.	*/
     if (ALIGNMENT > GC_DS_TAGS && EXTRA_BYTES != 0) {
@@ -770,7 +778,7 @@
   /* If we are keeping back pointers, the GC itself dirties all	*/
   /* pages on which objects have been marked, making 		*/
   /* incremental GC pointless.					*/
-  if (!GC_find_leak) {
+  if (!GC_find_leak && 0 == GETENV("GC_DISABLE_INCREMENTAL")) {
     DCL_LOCK_STATE;
     
     LOCK();


More information about the Gc mailing list