|
"Clark" <cdunson@gmail.com> wrote in message <hhvv48$60n$1@fred.mathworks.com>...
> Folks;
>
> Last year I set out to wrap the Processing (http://www.processing.org/) graphics engine into Matlab as a way of plotting and also getting Matlab nearer to some wiring/arduino stuff I was working on.
>
> I got pretty far. I embedded the Processing Java stuff into Matlab's java engine, over-rode Processing's base viewer object to interact with Matlab, plotted many plots, hundreds of times. Kinda cool.
>
> But I came up against a wall I could not cross. I was able to access the Processing API directly from within Matlab (that's the golden egg), and felt I had had succeeded in the design and implementation. So prove it. I wrote a loop to generate 10,000 spectrogram plots of crazy random size, etc. But alas ... Matlab out of memory after 10-12 plots.
>
> Blahst. (yes, Memory Leaks cost me more than a quarter once upon a time) All manner of attempted deletions, etc. Nothing worked. The only way to free the allocation seems to be to exit Matlab. So before I let inscription become epitaph so passively...
>
> Does anyone have any interest in this project? (It's one heckuva nice way to plot from Matlab :) If so, I'll dust it off and post.
>
> Cdog
>
> Oh: Here's the thread about it over there: (http://processing.org/discourse/yabb2/YaBB.pl?num=1235791346)
Try setting turb=[]; before clearing turb. This might enable better garbage collection by explicitly releasing the Java reference.
Also, try calling java.lang.System.gc(); directly (yes I know that in theory this should not be necessary and should not be done...).
Also, try reusing the same figure window to redraw, instead of trying to recreate a new window - Matlab keeps old figure frames hidden which may cause the effect you see. Alternately, search and destroy hidden remnants using java.awt.Frame.getFrames() and its relatives.
As a final alternative, try using the alternative excellent JFreeChart open-source charting library ( www.jfree.org ), which has a much wider support base AFAIK. There are several Matlab developers using it, as evidenced by a few CSSM queries over the years.
Yair Altman
http://UndocumentedMatlab.com
|