LEFT | RIGHT |
1 ;;;; This file is part of LilyPond, the GNU music typesetter. | 1 ;;;; This file is part of LilyPond, the GNU music typesetter. |
2 ;;;; | 2 ;;;; |
3 ;;;; Copyright (C) 1998--2012 Jan Nieuwenhuizen <janneke@gnu.org> | 3 ;;;; Copyright (C) 1998--2012 Jan Nieuwenhuizen <janneke@gnu.org> |
4 ;;;; Han-Wen Nienhuys <hanwen@xs4all.nl> | 4 ;;;; Han-Wen Nienhuys <hanwen@xs4all.nl> |
5 ;;;; | 5 ;;;; |
6 ;;;; LilyPond is free software: you can redistribute it and/or modify | 6 ;;;; LilyPond is free software: you can redistribute it and/or modify |
7 ;;;; it under the terms of the GNU General Public License as published by | 7 ;;;; it under the terms of the GNU General Public License as published by |
8 ;;;; the Free Software Foundation, either version 3 of the License, or | 8 ;;;; the Free Software Foundation, either version 3 of the License, or |
9 ;;;; (at your option) any later version. | 9 ;;;; (at your option) any later version. |
10 ;;;; | 10 ;;;; |
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 | 589 |
590 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 590 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
591 ;; debug memory leaks | 591 ;; debug memory leaks |
592 | 592 |
593 (define gc-dumping | 593 (define gc-dumping |
594 #f) | 594 #f) |
595 | 595 |
596 (define gc-protect-stat-count | 596 (define gc-protect-stat-count |
597 0) | 597 0) |
598 | 598 |
| 599 ;; Undead objects that should be ignored after the first time round |
| 600 (define gc-zombies |
| 601 (make-weak-key-hash-table 0)) |
| 602 |
599 (define-public (dump-live-object-stats outfile) | 603 (define-public (dump-live-object-stats outfile) |
600 (for-each (lambda (x) | 604 (for-each (lambda (x) |
601 (format outfile "~a: ~a\n" (car x) (cdr x))) | 605 (format outfile "~a: ~a\n" (car x) (cdr x))) |
602 (sort (gc-live-object-stats) | 606 (sort (gc-live-object-stats) |
603 (lambda (x y) | 607 (lambda (x y) |
604 (string<? (car x) (car y)))))) | 608 (string<? (car x) (car y)))))) |
605 | 609 |
606 (define-public (dump-gc-protects) | 610 (define-public (dump-gc-protects) |
607 (set! gc-protect-stat-count (1+ gc-protect-stat-count)) | 611 (set! gc-protect-stat-count (1+ gc-protect-stat-count)) |
608 (let* ((protects (sort (hash-table->alist (ly:protects)) | 612 (let* ((protects (sort (hash-table->alist (ly:protects)) |
(...skipping 28 matching lines...) Expand all Loading... |
637 (ly:progress "Live object statistics: GC'ing\n") | 641 (ly:progress "Live object statistics: GC'ing\n") |
638 (ly:reset-all-fonts) | 642 (ly:reset-all-fonts) |
639 (gc) | 643 (gc) |
640 (gc) | 644 (gc) |
641 (ly:progress "Asserting dead objects\n") | 645 (ly:progress "Asserting dead objects\n") |
642 (ly:set-option 'debug-gc-assert-parsed-dead #t) | 646 (ly:set-option 'debug-gc-assert-parsed-dead #t) |
643 (gc) | 647 (gc) |
644 (ly:set-option 'debug-gc-assert-parsed-dead #f) | 648 (ly:set-option 'debug-gc-assert-parsed-dead #f) |
645 (for-each | 649 (for-each |
646 (lambda (x) | 650 (lambda (x) |
647 » (ly:programming-error "Parsed object should be dead: ~a" x)) | 651 » (if (not (hashq-ref gc-zombies x)) |
| 652 » » (begin |
| 653 » » (ly:programming-error "Parsed object should be dead: ~a" x) |
| 654 » » (hashq-set! gc-zombies x #t)))) |
648 (ly:parsed-undead-list!)) | 655 (ly:parsed-undead-list!)) |
649 (set! stats (gc-live-object-stats)) | 656 (set! stats (gc-live-object-stats)) |
650 (ly:progress "Dumping live object statistics.\n") | 657 (ly:progress "Dumping live object statistics.\n") |
651 (dump-live-object-stats outfile))) | 658 (dump-live-object-stats outfile))) |
652 (newline outfile) | 659 (newline outfile) |
653 (let* ((stats (gc-stats))) | 660 (let* ((stats (gc-stats))) |
654 (for-each (lambda (sym) | 661 (for-each (lambda (sym) |
655 (format outfile "~a ~a ~a\n" | 662 (format outfile "~a ~a ~a\n" |
656 gc-protect-stat-count | 663 gc-protect-stat-count |
657 sym | 664 sym |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
884 (ly:exit 0 #f))))) | 891 (ly:exit 0 #f))))) |
885 | 892 |
886 (define (gui-no-files-handler) | 893 (define (gui-no-files-handler) |
887 (let* ((ly (string-append (ly:effective-prefix) "/ly/")) | 894 (let* ((ly (string-append (ly:effective-prefix) "/ly/")) |
888 ;; FIXME: soft-code, localize | 895 ;; FIXME: soft-code, localize |
889 (welcome-ly (string-append ly "Welcome_to_LilyPond.ly")) | 896 (welcome-ly (string-append ly "Welcome_to_LilyPond.ly")) |
890 (cmd (get-editor-command welcome-ly 0 0 0))) | 897 (cmd (get-editor-command welcome-ly 0 0 0))) |
891 (ly:message (_ "Invoking `~a'...\n") cmd) | 898 (ly:message (_ "Invoking `~a'...\n") cmd) |
892 (system cmd) | 899 (system cmd) |
893 (ly:exit 1 #f))) | 900 (ly:exit 1 #f))) |
LEFT | RIGHT |