[AC21.5] Fix numeric overflow leading to failure to GC

Marcus Crestani crestani at informatik.uni-tuebingen.de
Tue Aug 14 14:58:25 EDT 2007


APPROVE COMMIT 21.5

I have used this patch since Nix posted it, it is an important fix to
the new garbage collector.  Sorry for the long delay.

>>>>>"n" == nix  <nix at esperi.org.uk> writes:
n> 2006-12-29  Nix  <nix at esperi.org.uk>

n> 	* gc.c (recompute_need_to_garbage_collect): Avoid numeric
n> 	overflow in percentage calculation.

n> Index: 21.5/src/gc.c
n> ===================================================================
n> --- 21.5.orig/src/gc.c	2006-12-29 18:21:43.000000000 +0000
n> +++ 21.5/src/gc.c	2006-12-29 22:11:22.000000000 +0000
n> @@ -314,12 +314,12 @@
n>        (consing_since_gc > gc_cons_threshold
n>         &&
n>  #if 0 /* #### implement this better */
n> -       (100 * consing_since_gc) / total_data_usage () >=
n> -       gc_cons_percentage
n> +       ((double)consing_since_gc) / total_data_usage()) >=
n> +      ((double)gc_cons_percentage / 100)
n>  #else
n>         (!total_gc_usage_set ||
n> -	(100 * consing_since_gc) / total_gc_usage >=
n> -	gc_cons_percentage)
n> +	((double)consing_since_gc / total_gc_usage) >=
n> +	((double)gc_cons_percentage / 100))
n>  #endif
n>         );
n>    recompute_funcall_allocation_flag ();

n> _______________________________________________
n> XEmacs-Patches mailing list
n> XEmacs-Patches at xemacs.org
n> http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches

-- 
Marcus



More information about the XEmacs-Patches mailing list