> From: "MOO" <[EMAIL PROTECTED]>

> Hi Christopher,
> 
> I'm figuring out the memory bottleneck in ptolemy as a java application by
> using very complex model like the butterfly in the quick tour.

The butterfly is not very complex in terms of the number of actors.
It has a few actors, one of which does a bunch of work in the
expression.  We used to have a more complex butterfly actor that did
all that work via separate actors.

The butterfly actor does have a high number of iterations though, so
it might be useful for finding leaks in the basic design.

> i runned both a graphical and nongraphical simualtion using the
> (ptexecute)..and there was no difference between both from the Total memory
> and the used memory and the execution time.
> i did this for different number of iterations and actors.
> so what is the difference ? 

I find this hard to believe.  Perhaps your nongraphical simulation is
still pulling in swing and awt.  You could try using java -verbose:class
to see what classes are being loaded.  

I think ptinvoke will load swing. 
ptinvoke runs actor.gui.PtExecuteApplication.
PtExecuteApplication extends MoMLApplication.

MoLApplication sets the look and feel, and
ptolemy.actor.gui.Configuration.createPrimaryTableau() calls
javax.swing.SwingUtilities.invokeLater(), which starts up Swing,
so we can't use MoMLApplication for non-graphical simulations.

I hacked up MoMLSimpleApplication, which should not load swing, see
http://ptolemy.eecs.berkeley.edu/~cxh/ptpub/filter.htm

Can you provide some data about your tests?
What OS? What JVM?
What were the arguments to the JVM?
What models did you run?
What were the free and total memory usage numbers?
Did you try turning on and off the JIT?
Did you try running the models several times and noting the changes in
time and memory?

Remember, Mark Twain attibuted the following to Disraeli:
"There are lies, damn lies and statistics" :-)

Profiling an applications that has a JIT and GC is pretty tricky.

I'm sure that there are memory improvements that can be made.
We've done some tuning, but there is always more.

> 2nd : 
> I'd like to figure out the strategy used in assigning the memory for the
> model to be simulated, specially at the start..on what bases does the
> program allocate memory for a particular model both total and used memory .

Take a look at how the model gets setup in actor.lib.  

I think in SDF, it should be possible for a non graphical model to not
consume more memory as it runs.  The bulk of the memory consumption in
SDF should be in scheduling and allocating the actors.

JProbe might be useful.

> 3rd : 
> i'd like to know the behaviour of the garbage collection . from my
> experiments i noticed that its only active when the free memory becomes so
> small . then it works to free memory for the execution ..
> please how the garbage collection operate in ptolemy and is there a way to
> control the garbage collection process ?

I don't think we do much with garbage collection in Ptolemy II, we let
the garbage collector try its best.  There might be some value in
calling System.gc() after a model finishes.

Try consulting the Java documentation for more information about gc.
A good place to start is
http://java.sun.com/docs/books/tutorial/search.html
The basic idea is that System.gc() only suggests that gc occur.

> i use 256 m ram machine and i use -Xmx200 m to assign 200 MB for the
> Ptolemy ..
> 
> Thank you too much for your assistance .
> Regards,
> MO. 

-Christopher

----------------------------------------------------------------------------
Posted to the ptolemy-hackers mailing list.  Please send administrative
mail for this list to: [EMAIL PROTECTED]

Reply via email to