Browse files

fix GC-LOGFILE when none has been set

  ...and the return value from (SETF GC-LOGFILE).
  • Loading branch information...
1 parent 8a7fd84 commit b35d5f4c386c3e573ff752de1c3770da7d8034f6 @snmsts snmsts committed with nikodemus Oct 3, 2012
Showing with 18 additions and 3 deletions.
  1. +2 −0 NEWS
  2. +4 −3 src/code/gc.lisp
  3. +12 −0 tests/gc.impure.lisp
@@ -6,6 +6,8 @@ changes relative to sbcl-1.1.0:
by lexical bindings.
* bug fix: stack allocation was prevented by high DEBUG declaration in several
+ * bug fix: SB-EXT:GC-LOGFILE signaled an error when no logfile was set. (thanks
+ to SANO Masatoshi)
changes in sbcl-1.1.0 relative to sbcl-1.0.58:
* enhancement: New variable, sb-ext:*disassemble-annotate* for controlling
@@ -164,16 +164,17 @@ run in any thread.")
(old %gc-logfile))
(setf %gc-logfile new)
(when old
- (sb!alien:free-alien old))))
+ (sb!alien:free-alien old))
+ pathname))
(defun gc-logfile ()
"Return the pathname used to log garbage collections. Can be SETF.
Default is NIL, meaning collections are not logged. If non-null, the
designated file is opened before and after each collection, and generation
statistics are appended to it."
- (let ((val %gc-logfile))
+ (let ((val (cast %gc-logfile c-string)))
(when val
- (native-pathname (cast val c-string)))))
+ (native-pathname val))))
(declaim (inline dynamic-space-size))
(defun dynamic-space-size ()
"Size of the dynamic space in bytes."
@@ -103,3 +103,15 @@
(assert (eql len (* n (length "hi there!"))))))
(storage-condition ()
+(with-test (:name :gc-logfile)
+ (assert (not (gc-logfile)))
+ (let ((p #p"gc.log"))
+ (assert (not (probe-file p)))
+ (assert (equal p (setf (gc-logfile) p)))
+ (gc)
+ (let ((p2 (gc-logfile)))
+ (assert (equal (truename p2) (truename p))))
+ (assert (not (setf (gc-logfile) nil)))
+ (assert (not (gc-logfile)))
+ (delete-file p)))

0 comments on commit b35d5f4

Please sign in to comment.