From c7d55b2b61d7cf5310c40b6e76fb31a482f812f1 Mon Sep 17 00:00:00 2001 From: David Kastrup Date: Thu, 18 Oct 2012 14:47:47 +0200 Subject: [PATCH] Implement session-terminate in lily.scm session-wide variables are now reinitialized _after_ the session before starting garbage collection statistics and looking for undead objects. --- scm/lily.scm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scm/lily.scm b/scm/lily.scm index b1de941c47..d7c4bf6587 100644 --- a/scm/lily.scm +++ b/scm/lily.scm @@ -72,6 +72,12 @@ session has started." (define-session ,name ,value) (export ,name))) +(define (session-terminate) + (if (ly:undead? lilypond-declarations) + (for-each + (lambda (p) (variable-set! (cadr p) (cddr p))) + (ly:get-undead lilypond-declarations)))) + (define-public (session-initialize thunk) "Initialize this session. The first session in a LilyPond run is initialized by calling @var{thunk}, then recording the values of all @@ -905,6 +911,7 @@ PIDs or the number of the process." (mtrace:start-trace (ly:get-option 'trace-memory-frequency))) (lilypond-file handler x) (ly:check-expected-warnings) + (session-terminate) (if start-measurements (dump-profile x start-measurements (profile-measurements))) (if (ly:get-option 'trace-memory-frequency) -- 2.39.2