X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Fgc.lisp;h=523f347bf147e729f601cfc125f71c16f0c0d911;hb=550e5afc7ad95ff1e1bbfe932bf8dd81b0c4dce6;hp=8bf7ee397b9e267f74eebe73d76adc4af608511b;hpb=4df3887d4f74248fb2ce830b86eb07fd30986d8a;p=sbcl.git diff --git a/src/code/gc.lisp b/src/code/gc.lisp index 8bf7ee3..523f347 100644 --- a/src/code/gc.lisp +++ b/src/code/gc.lisp @@ -76,7 +76,7 @@ (room-minimal-info) (sb!vm:memory-usage :count-spaces '(:dynamic) :print-spaces t - :cutoff 0.05s0 + :cutoff 0.05f0 :print-summary nil)) (defun room-maximal-info () @@ -179,25 +179,49 @@ and submit it as a patch." ;;; a limit to help catch programs which allocate too much memory, ;;; since a hard heap overflow is so hard to recover from +;;; +;;; FIXME: Like *GC-TRIGGER*, this variable (1) should probably be +;;; denominated in a larger unit than bytes and (2) should probably be +;;; renamed so that it's clear from the name what unit it's +;;; denominated in. (declaim (type (or unsigned-byte null) *soft-heap-limit*)) -(defvar *soft-heap-limit* nil) +(defvar *soft-heap-limit* + ;; As long as *GC-TRIGGER* is DECLAIMed as INDEX, we know that + ;; MOST-POSITIVE-FIXNUM is a hard limit on how much memory can be + ;; allocated. (Not necessarily *the* hard limit, which is fairly + ;; likely something like a Unix per-process limit that we don't know + ;; about, but a hard limit anyway.) And this gives us a reasonable + ;; conservative default for the soft limit... + (- most-positive-fixnum + *bytes-consed-between-gcs*)) + +;;;; The following specials are used to control when garbage +;;;; collection occurs. ;;; When the dynamic usage increases beyond this amount, the system ;;; notes that a garbage collection needs to occur by setting ;;; *NEED-TO-COLLECT-GARBAGE* to T. It starts out as NIL meaning ;;; nobody has figured out what it should be yet. -(defvar *gc-trigger* nil) - +;;; +;;; FIXME: *GC-TRIGGER* seems to be denominated in bytes, not words. +;;; And limiting it to INDEX is fairly reasonable in order to avoid +;;; bignum arithmetic on every allocation, and to minimize the need +;;; for thought about weird gotchas of the GC-control mechanism itself +;;; consing as it operates. But as of sbcl-0.7.5, 512Mbytes of memory +;;; costs $54.95 at Fry's in Dallas but cheap consumer 64-bit machines +;;; are still over the horizon, so gratuitously limiting our heap size +;;; to FIXNUM bytes seems fairly stupid. It'd be reasonable to +;;; (1) allow arbitrary UNSIGNED-BYTE values of *GC-TRIGGER*, or +;;; (2) redenominate this variable in words instead of bytes, postponing +;;; the problem to heaps which exceed 50% of the machine's address +;;; space, or even +;;; (3) redemoninate this variable in CONS-sized two-word units, +;;; allowing it to cover the entire memory space at the price of +;;; possible loss of clarity. +;;; (And whatever is done, it'd also be good to rename the variable so +;;; that it's clear what unit it's denominated in.) (declaim (type (or index null) *gc-trigger*)) - -;;; On the X86, we store the GC trigger in a ``static'' symbol instead -;;; of letting magic C code handle it. It gets initialized by the -;;; startup code. -#!+x86 -(defvar sb!vm::*internal-gc-trigger*) - -;;;; The following specials are used to control when garbage collection -;;;; occurs. +(defvar *gc-trigger* nil) ;;; When non-NIL, inhibits garbage collection. (defvar *gc-inhibit*) ; initialized in cold init