Hi,
I have a real-time time series display that periodically updates the
time axis. I've been running into some out of memory problems, so I
wrote a little test program (attached) that has revealed some bugs. I'm
seeing the problems with recent stable and beta versions of the jdk and
java3d on Linux and Windows and with the latest visad.jar.
1) After numerous calls (depending on max heap size, less than 5000 with
the attached program with jvm defaults) to ScalarMap.setRange(), I get
an OutOfMemoryError. Smells like a memory leak. RangeControl.setRange()
also leads to an OutOfMemoryError. Hopefully it is not in java3d so we
can do something about it. It does not happen with java2d
(DisplayImplJ2D), though.
2) While running the test, I saw what looks like a Thread bug. Every
once in a while I'll see the following exception. It occurs "randomly"
but not when I throw in a sleep.
java.lang.ClassCastException: javax.media.j3d.GeometryAtom
at
javax.media.j3d.TransformGroupRetained.setTransform(TransformGroupRetained.java:161)
at
javax.media.j3d.TransformGroup.setTransform(TransformGroup.java:111)
at
visad.java3d.DisplayRendererJ3D.setTransform3D(DisplayRendererJ3D.java:1254)
at
visad.java3d.ProjectionControlJ3D.setMatrix(ProjectionControlJ3D.java:102)
at
visad.java3d.DisplayRendererJ3D.setWaitFlag(DisplayRendererJ3D.java:1376)
at visad.DisplayImpl.doAction(DisplayImpl.java:1312)
at visad.ActionImpl.run(ActionImpl.java:238)
at visad.util.ThreadPool$ThreadMinnow.run(ThreadPool.java:95)
Let me know if you need more details.
Cheers,
Doug
--
*----------------------------------------------------------------------*
| Doug Lindholm, Software Engineer | E-mail: lind@xxxxxxxx |
| Research Applications Program | Phone: 303-497-8374 |
| National Center for Atmospheric Research | |
| P.O. Box 3000 | There's no place |
| Boulder, Colorado 80307-3000 | like $HOME |
*----------------------------------------------------------------------*
import visad.*;
import visad.java2d.*;
import visad.java3d.*;
import javax.swing.*;
public class MemoryTest {
public void init() {
try {
//DisplayImplJ2D display = new DisplayImplJ2D( "test" );
DisplayImplJ3D display = new DisplayImplJ3D( "test" );
//DisplayImplJ3D display = new DisplayImplJ3D( "test", new
TwoDDisplayRendererJ3D() );
ScalarMap xmap = new ScalarMap( RealType.Time, Display.XAxis );
display.addMap(xmap);
int count = 0;
while ( true ) {
double now = (double) (System.currentTimeMillis() / 1000.0);
System.out.println("step " + count++ + " now = " + now );
double then = now - 3600.0;
xmap.setRange(then, now);
//Thread.sleep(10);
}
}
catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
MemoryTest test = new MemoryTest();
test.init();
}
}