Forums > Java

Problem with Java copyArrayToVectorPlanar

February 12, 2009 | 12:13 pm

Hi,

I’m experiencing frequent, yet inconsistent, crashes on my Max patch which all point to a problem with the Java ‘copyArrayToVectorPlanar’ command. The patch I’m using is huge and very complicated, so I haven’t attached here, but I am attaching the error report and system configuration docs.

I had experienced memory leaks and crashes with Java externals in the past, but these had all been down to creating Jitter matrix objects and not disposing of them correctly. I’ve avoided this problem in this patch, but the crashes are still occuring. I’m using the latest versions of Max/MSP and Jitter (downloaded today).

Any input or suggestions would be gratefully appreciated!

Cheers

Tom

(Apologies for cross-posting – I hadn’t noticed the separate Java forum at first)

Here’s an extract from the piece of Java causing the crashes…

public void bang()
{
utilcounter++;
if (totalParticles < maxParticles -1 && (utilcounter % 4 == 0)) {
particle[totalParticles] = new Particle(0.,0.,0.,totalParticles,random(1.,2.));
totalParticles++;
counter++;
}

double[] xlocs = new double[totalParticles];
double[] ylocs = new double[totalParticles];
double[] zlocs = new double[totalParticles];

for (int i=0;i
//charges
particle[i].field();
//friction
particle[i].xv *= momentum;
particle[i].yv *= momentum;
particle[i].zv *= 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] = particle[i].z;

}

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());
outlet(1,totalParticles+1);

}


February 12, 2009 | 5:12 pm

I’m getting another type of error report now, so I’m attaching it in case it helps in working out where the problem is. I can’t tell from reading this report whether it’s the Java that’s to blame in this case. Any insights anyone?

Cheers

Tom


Viewing 2 posts - 1 through 2 (of 2 total)