NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.

Re: Memory problems

Hi Ibrahim,

You may be able to reduce memory use by combining all your
FlatFields into one large FieldImpl. That is, if T is the
MathType of your FlatFields (assuming they all have the same
MathType), then let (index -> T) be the type of a FieldImpl,
with domain Set Integer1DSet(index, number_of_particles).
Add each FlatField by field.setSample(i, particles[i].sphere_field).
Linking only a single FieldImpl to your Display will save a
lot of memory.

Also, if each FlatField does have the same MathType, re-use
the same MathType rather than reconstructing new ones.

Good luck,
Bill
----------------------------------------------------------
Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI  53706
hibbard@xxxxxxxxxxxxxxxxx  608-263-4427  fax: 608-263-6738
http://www.ssec.wisc.edu/~billh/vis.html


On Sun, 14 Apr 2002, Ibrahim Z Mohammad wrote:

> Hi,
> I'm trying to display multiple objects(particles) in the same display
> window. I've used the following code to generate the number of particles I
> need:
>
>       particles[i].v = new RealType(Integer.toString(i),null,null);
>       particles[i].sphere_func = new FunctionType(xyz, particles[i].v);
>       particles[i].sphere_set = new Gridded3DSet(xyz, samples_sphere,
> particles[i].Mfold_sphere[0], particles[i].Mfold_sphere[1]);
>       particles[i].sphere_field = new FlatField(particles[i].sphere_func,
> particles[i].sphere_set);
>       particles[i].sphere_field.setSamples(values_sphere, false);
>       particles[i].sphere_map = new ScalarMap(particles[i].v,
> Display.Green);
>       display.addMap(particles[i].sphere_map);
>       particles[i].sphere_ref = new DataReferenceImpl("sphere_ref");
>       particles[i].sphere_ref.setData(particles[i].sphere_field);
>
> where particles[] is an array of objects of myClass. So far it all works
> fine, but when I try to add all the references to the display using:
>
>       display.addReference(particles[i].sphere_ref, null);
>
> I run into memory problems. So far I've succeeded in displaying upto 500
> particles simultaneously, but my program needs to go much further than that.
> I dont think the problem is with having very long arrays, because the first
> part of the code runs through very quickly without any problems (I ran the
> .addReference in a seperate loop to see where the problem was). I'm
> wondering if there is a limit to the number of references you can add to a
> DisplayImpJ3d object? The error I get is OutOfMemoryError <<no stack trace
> available>>.
> I've tried using -Xmx to increase available memory, and I'm also setting the
> objects to 'null' after adding each reference and then running System.gc()
> periodically to force the garbage collector, but all that doesnt seem to
> help much.
> Would appreciate you help.
>
>
> Ibrahim Z Mohammad
> *                                        *
> University of Illinois at Urbana-Champaign
> *                                        *
>
>


  • 2002 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: