SCM
Context_def::mark_smob (SCM smob)
{
+ ASSERT_LIVE_IS_ALLOWED();
+
Context_def *me = (Context_def *) SCM_CELL_WORD_1 (smob);
scm_gc_mark (me->description_);
#include "lily-guile.hh"
extern bool parse_protect_global;
+extern bool parsed_objects_should_be_dead;
struct Parse_start
{
#include "lily-guile.hh"
#include "virtual-methods.hh"
+#include "warn.hh"
/*
Smobs are GUILEs mechanism of exporting C(++) objects to the Scheme
void protect_smob (SCM smob, SCM *prot_cons);
void unprotect_smob (SCM smob, SCM *prot_cons);
+extern bool parsed_objects_should_be_dead;
+
+#define ASSERT_LIVE_IS_ALLOWED() \
+ static bool passed_here_once;\
+ if (parsed_objects_should_be_dead && !passed_here_once) { \
+ programming_error (string ("Parsed object should be dead: ") + __PRETTY_FUNCTION__ ); \
+ passed_here_once = true;\
+ }
+
#endif /* SMOBS_HH */
}
bool parse_protect_global = true;
+bool parsed_objects_should_be_dead = false;
/* Try parsing. Upon failure return SCM_UNDEFINED.
FIXME: shouldn't we return SCM_UNSCPECIFIED -- jcn */
SCM
Prob::mark_smob (SCM smob)
{
+ ASSERT_LIVE_IS_ALLOWED();
+
Prob *system = (Prob *) SCM_CELL_WORD_1 (smob);
scm_gc_mark (system->mutable_property_alist_);
system->derived_mark ();
do_internal_type_checking_global = to_boolean (val);
val = scm_from_bool (to_boolean (val));
}
+ else if (var == ly_symbol2scm ("debug-gc-assert-parsed-dead"))
+ {
+ parsed_objects_should_be_dead = to_boolean (val);
+ val = scm_from_bool (parsed_objects_should_be_dead);
+ }
else if (var == ly_symbol2scm ("old-relative"))
{
lily_1_8_relative = to_boolean (val);
(clip-systems #f "Generate cut-out snippets of a score")
(debug-gc #f
"dump memory debugging statistics")
+ (debug-gc-assert-parsed-dead #f
+ "for memory debugging: ensure that all refs to parsed objects are dead.")
+
(debug-midi #f "generate human readable MIDI")
(delete-intermediate-files #f
"delete unusable PostScript files")
(display "Live object statistics: GC'ing\n")
(gc)
(gc)
+ (ly:set-option 'debug-gc-assert-parsed-dead #t)
+ (gc)
(set! stats (gc-live-object-stats))
(display "Dumping live object statistics.\n")
(for-each
(lambda (x)
+ (ly:set-option 'debug-gc-assert-parsed-dead #f)
(lilypond-file handler x)
(ly:clear-anonymous-modules)
(if (ly:get-option 'debug-gc)
(lambda () (ly:parse-file file-name))
(lambda (x . args) (handler x file-name))))
-(use-modules (scm editor)
- )
+(use-modules (scm editor))
(define-public (gui-main files)
(if (null? files)