From: hanwen Date: Sun, 1 Aug 2004 14:10:14 +0000 (+0000) Subject: * lily/my-lily-parser.cc (LY_DEFINE): plug memory leak: unprotect X-Git-Tag: release/2.3.12~62 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=9e438238fabd3365fff387d50e3493d1a26ce367;p=lilypond.git * lily/my-lily-parser.cc (LY_DEFINE): plug memory leak: unprotect parser. * lily/include/my-lily-lexer.hh (class Lily_lexer): smobify lexer. --- diff --git a/ChangeLog b/ChangeLog index bc3bc92449..7729ba0313 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,14 @@ 2004-08-01 Han-Wen Nienhuys + * lily/my-lily-parser.cc (LY_DEFINE): plug memory leak: unprotect + parser. + + * lily/include/my-lily-lexer.hh (class Lily_lexer): smobify lexer. + * lily/include/my-lily-parser.hh: rename My_lily -> Lily * make/mutopia-targets.make (local-WWW): don't make ps.gz - examples. They take huge amounts of space. + examples. They take a huge amount of space. * Documentation/user/GNUmakefile: fix symlinks. diff --git a/VERSION b/VERSION index e672b3863f..293ef2240f 100644 --- a/VERSION +++ b/VERSION @@ -2,5 +2,5 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=2 MINOR_VERSION=3 PATCH_LEVEL=10 -MY_PATCH_LEVEL= +MY_PATCH_LEVEL=hwn1 diff --git a/lily/include/my-lily-lexer.hh b/lily/include/my-lily-lexer.hh index b3c32f6f52..b697068bcd 100644 --- a/lily/include/my-lily-lexer.hh +++ b/lily/include/my-lily-lexer.hh @@ -59,8 +59,6 @@ public: Lily_lexer (Sources*); Lily_lexer (Lily_lexer const&); - ~Lily_lexer (); - int yylex (); void prepare_for_next_token (); diff --git a/lily/my-lily-parser.cc b/lily/my-lily-parser.cc index c271d4ed29..5a5c06814d 100644 --- a/lily/my-lily-parser.cc +++ b/lily/my-lily-parser.cc @@ -86,6 +86,7 @@ void Lily_parser::parse_file (String init, String name, String out_name) { lexer_ = new Lily_lexer (sources_); + scm_gc_unprotect_object (lexer_->self_scm ()); // TODO: use $parser lexer_->set_identifier (ly_symbol2scm ("parser"), self_scm ()); @@ -111,8 +112,6 @@ Lily_parser::parse_file (String init, String name, String out_name) } error_level_ = error_level_ | lexer_->error_level_; - - scm_gc_unprotect_object (lexer_->self_scm ()); lexer_ = 0; } @@ -122,6 +121,7 @@ Lily_parser::parse_string (String ly_code) Lily_lexer *parent = lexer_; lexer_ = (parent == 0 ? new Lily_lexer (sources_) : new Lily_lexer (*parent)); + scm_gc_unprotect_object (lexer_->self_scm ()); SCM oldmod = scm_current_module (); @@ -159,7 +159,6 @@ Lily_parser::parse_string (String ly_code) } scm_set_current_module (oldmod); - scm_gc_unprotect_object (lexer_->self_scm ()); lexer_ = 0; } @@ -302,6 +301,7 @@ LY_DEFINE (ly_parse_file, "ly:parse-file", parser->parse_file (init, file_name, out_file); bool error = parser->error_level_; + scm_gc_unprotect_object (parser->self_scm ()); parser = 0; if (error) /* TODO: pass renamed input file too. */ @@ -324,6 +324,7 @@ LY_DEFINE (ly_parse_string, "ly:parse-string", scm_module_define (global_lily_module, ly_symbol2scm ("parser"), parser->self_scm ()); parser->parse_string (ly_scm2string (ly_code)); + scm_gc_unprotect_object (parser->self_scm ()); parser = 0; return SCM_UNSPECIFIED; diff --git a/scm/lily.scm b/scm/lily.scm index 1e4ef64b95..a9339f97b7 100644 --- a/scm/lily.scm +++ b/scm/lily.scm @@ -531,8 +531,7 @@ L1 is copied, L2 not. (outfile (open-file (string-append "gcstat-" (number->string gc-protect-stat-count) ".scm" - ) "w")) - ) + ) "w"))) (display "DUMPING...\n") (display @@ -593,7 +592,10 @@ L1 is copied, L2 not. (let* ((failed '()) (handler (lambda (key arg) (set! failed (cons arg failed))))) (for-each - (lambda (f) (catch 'ly-file-failed (lambda () (ly:parse-file f)) handler)) + (lambda (f) + (catch 'ly-file-failed (lambda () (ly:parse-file f)) handler) + (dump-gc-protects) + ) files) (if (pair? failed)