Print

Print


Hi,

> The other right way to do this is to only do GATHERING and ADDING when you're 
> doing REDRAWING in the case of non-timeseries.  That's slightly nontrivial to 
> code up so I'll have to think more about it.  But at least this should work for 
> the moment.
Thanks for the quick reply.
I tested the code and if I now set Add Data to 100 steps, my update
routine is indeed only called every 100 steps. However after a few
hundred steps the simulation slows down and I finally get an out of
memory error (see below).

But don't worry. Take your time to solve this problem for the next release.
For the time being I have a "if ((schedule.getSteps()%100)==0)" line in
my function and I keep the data in a class variable so that I can return
them for the other time steps.

Best regards,
  Axel



Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java
heap space
    at java.awt.image.DataBufferInt.<init>(Unknown Source)
    at java.awt.image.Raster.createPackedRaster(Unknown Source)
    at
java.awt.image.DirectColorModel.createCompatibleWritableRaster(Unknown
Source)
    at java.awt.GraphicsConfiguration.createCompatibleImage(Unknown Source)
    at java.awt.GraphicsConfiguration.createCompatibleImage(Unknown Source)
    at sun.awt.image.SunVolatileImage.getBackupImage(Unknown Source)
    at sun.awt.image.VolatileSurfaceManager.getBackupSurface(Unknown Source)
    at sun.awt.image.VolatileSurfaceManager.initialize(Unknown Source)
    at sun.awt.image.SunVolatileImage.<init>(Unknown Source)
    at sun.awt.image.SunVolatileImage.<init>(Unknown Source)
    at
java.awt.GraphicsConfiguration.createCompatibleVolatileImage(Unknown Source)
    at
java.awt.GraphicsConfiguration.createCompatibleVolatileImage(Unknown Source)
    at javax.swing.RepaintManager.getVolatileOffscreenBuffer(Unknown Source)
    at javax.swing.RepaintManager$PaintManager.paint(Unknown Source)
    at javax.swing.BufferStrategyPaintManager.paint(Unknown Source)
    at javax.swing.RepaintManager.paint(Unknown Source)
    at javax.swing.JComponent.paint(Unknown Source)
    at java.awt.GraphicsCallback$PaintCallback.run(Unknown Source)
    at sun.awt.SunGraphicsCallback.runOneComponent(Unknown Source)
    at sun.awt.SunGraphicsCallback.runComponents(Unknown Source)
    at java.awt.Container.paint(Unknown Source)
    at java.awt.Window.paint(Unknown Source)
    at javax.swing.RepaintManager$3.run(Unknown Source)
    at javax.swing.RepaintManager$3.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown
Source)
    at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
    at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
    at javax.swing.RepaintManager.prePaintDirtyRegions(Unknown Source)
    at javax.swing.RepaintManager.access$1100(Unknown Source)
    at javax.swing.RepaintManager$ProcessingRunnable.run(Unknown Source)
    at java.awt.event.InvocationEvent.dispatch(Unknown Source)