From e5eb3dca110039074a796660a5d61b45fb39c8f3 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Tue, 12 Dec 2006 00:40:15 +0100 Subject: [PATCH] Do programmed garbage collect at file boundary. This fixes extraneous memory usage during input/regression processing. Apparently, the conservative scanning halfway a file marks way too much cells. --- scm/lily.scm | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/scm/lily.scm b/scm/lily.scm index d886ddb99e..e71d400859 100644 --- a/scm/lily.scm +++ b/scm/lily.scm @@ -349,8 +349,10 @@ The syntax is the same as `define*-public'." (,vector? . "vector"))) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; debug mem leaks +(define gc-dumping #f) (define gc-protect-stat-count 0) (define-public (dump-gc-protects) (set! gc-protect-stat-count (1+ gc-protect-stat-count)) @@ -365,6 +367,7 @@ The syntax is the same as `define*-public'." ".scm")) (outfile (open-file out-file-name "w"))) + (set! gc-dumping #t) (display (format "Dumping GC statistics ~a...\n" out-file-name)) (display (map (lambda (y) @@ -425,6 +428,8 @@ The syntax is the same as `define*-public'." '(protected-objects bytes-malloced cell-heap-size ))) + + (set! gc-dumping #f) )) @@ -534,11 +539,18 @@ The syntax is the same as `define*-public'." )) (let* ((failed '()) + (first #t) (handler (lambda (key failed-file) (set! failed (append (list failed-file) failed))))) (for-each (lambda (x) + + ;; We don't carry info across file boundaries + (if first + (set! first #f) + (gc)) + (lilypond-file handler x) (ly:clear-anonymous-modules) (if (ly:get-option 'debug-gc) -- 2.39.5