[kepler-dev] MoMLFilter change is not backward compatible

Christopher Brooks cxh at eecs.berkeley.edu
Tue May 31 17:30:21 PDT 2011


So as to avoid a memory leak in some of the MoMLFilters that had
static MoMLParsers, I added two methods to MoMLFilter that each take a
MoMLParser as an argument.

This means that classes that implemented MoMLFilter should now
extend ptolemy.moml.filter.MoMLFilterSimple.
MoMLFilterSimple provides simple implementations for the
new methods.

There was no easy way to avoid this backward compatibility problem.

One possibility was to modify MoMLFilter by adding the MoMLFilter
argument to the two methods.  This seemed wrong because it was
not at all backward compatible and it required updating each class
that implements MoMLFilter.  Instead, by introducing MoMLFilterSimple,
the classes that implemented MoMLFilter can now extend MoMLFilterSimple,
which is a two line change.  Note that we did modify MoMLFilter in
the recent past (2009 or 2010) so that it takes a file argument
and this change did not cause huge problems.

Another possibility was to create a second set of MoMLFilters, but
this seemed lame because it would require developers to manage
two sets of filters.

For those interested in the memory leak issue, I've been working on
ptolemy.moml.test.UnloadModelTest, which was originally supplied by
Brian Hudson.  That file now loads a simple model, runs it and then
unloads the model.  Formerly, the class would leak a MoMLParser
and the TypedCompositeActor.  Now, it no longer leaks those classes.
I'm working on getting that file to not leak the Manager, but
need to look into things further.

If you are interested in memory leaks, see Aaron Schultz' page:
https://kepler-project.org/developers/teams/build/dealing-with-memory-leak-in-kepler

_Christopher

-- 
Christopher Brooks, PMP                       University of California
CHESS Executive Director                      US Mail: 337 Cory Hall
Programmer/Analyst CHESS/Ptolemy/Trust        Berkeley, CA 94720-1774
ph: 510.643.9841      	                      (Office: 545Q Cory)
home: (F-Tu) 707.665.0131 cell: 707.332.0670


More information about the Kepler-dev mailing list