[jitter] Homing in on the problem
Tom W
tom at kma.co.uk
Fri Feb 1 02:42:07 MST 2008
- Previous message: [jitter] Re: Quick Loading into jit.qt.movie
- Next message: [jitter] Re: Homing in on the problem
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi again.
I have got a little close to what might be the problem. There's a memory leak occurring in a Java external that I'm using: it appears to be caused by creating a new JitterMatrix object on each bang. I'm looking for alternative ways around this, but here's the code in case anyone can offer suggestions: as you might gather, the number of 'particles' that I'm dealing with is increasing over time up to a maximum of (totalparticles), but the memory usage keeps increasing even after this point is reached.
**** BEGIN EXTRACT FROM JAVA FILE *****
public void bang()
{
utilcounter++;
if (totalParticles < maxParticles -1 && (utilcounter % 4 == 0)) {
particle[totalParticles] = new Particle(mouseX,mouseY,totalParticles,1.);
totalParticles++;
counter++;
}
double[] xlocs = new double[totalParticles];
double[] ylocs = new double[totalParticles];
double[] zlocs = new double[totalParticles];
for (int i=0;i<totalParticles;i++) {
//charges
particle[i].field();
//friction
particle[i].xv *= momentum;
particle[i].yv *= momentum;
//gravity
particle[i].applyGravity();
//update position
particle[i].move();
//fill arrays for matrix
xlocs[i] = particle[i].x;
ylocs[i] = particle[i].y;
zlocs[i] = 0.0;
}
jm = new JitterMatrix(3,"float64",totalParticles); // THIS LINE CAUSES A MEMORY LEAK!
jm.copyArrayToVectorPlanar(0,0,null,xlocs,totalParticles,0);
jm.copyArrayToVectorPlanar(1,0,null,ylocs,totalParticles,0);
jm.copyArrayToVectorPlanar(2,0,null,zlocs,totalParticles,0);
outlet(0,"jit_matrix",jm.getName());
}
**** END EXTRACT FROM JAVA FILE *****
- Previous message: [jitter] Re: Quick Loading into jit.qt.movie
- Next message: [jitter] Re: Homing in on the problem
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
