Forums > Jitter

Sporadic crashes – Java responsible?

February 1, 2008 | 8:41 am

Hi all,

I’m having trouble with Max / Jitter crashing, and unfortunately, it’s not easily reproducable. I have a very intricate patcher which is designed to run continuously (it’s controlling a public installation which runs for 5 hours every night). The cycle of the installation is about 12 minutes, and I have no troubles running this through 2 or 3 times. But eventually – every time – the application crashes. I’m attaching the error report from the last crash, which seems to indicate an issue with Java’s copyArrayToVectorPlanar. Are there any known issues with this code? I’m not even sure I’m interpreting the crash report correctly. If this bit of Java is the problem, are there any alternative ways of filling up a three plane matrix from Java arrays? I heard that there are some undocumented operators that fill up the whole matrix in one go, rather than having to do it plane by plane.

I can’t post the whole patcher on here as it’s huge and rather complicated, but I could post bits and pieces of it if that helps.

I’m running Max 4.6.2 and Jitter 1.6.2 on a Mac Pro (8 core, 8GB RAM)

Any help gratefully received.

Cheers

Tom


February 1, 2008 | 9:42 am

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 (maxParticles), 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
//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 *****


February 1, 2008 | 12:46 pm

Hi Tom

It sounds like i’m doing a similar things to you – with some similar problems that i suspect are down to memory leaks somewhere (but i think i’ve ruled out my own Java bugs now! ha ha ha! :)

One issue i came up against a while ago (a runaway memory leak) was a similar thing to yours – my solution (/hack) was:

Make the var you assign your matrix to a member variable (your "jm" is my "jitterMatrix") and each time you reset it do "freePeer()" – like this:

if (jitterMatrix != null) {
jitterMatrix.freePeer();
jitterMatrix = null;
}

Hope that helps.

My problem is that when loading images (into jit.qt.movie objects via an asyncread, then applying a soft edge filter with jit.gl.slab, then piping that into a jit.gl.videoplane to wave it about and then sending it to render) that every now and again (one in 50?) times the thing appears just white with no error message or excuse or anything.

I am using the incremental Jitter framework update (jitterapi_x2_121207.dmg) so i guess i should replace the asyncreads with just "read" (and go back to 1.6.3) and see if that solves it. However, that looks rubbish as it interrupts the stuff already on screen.

Ring any bells, anyone?

(again, this is a huge load of patches so hard to post an example and, in theory, it has already launched yesterday!)

yours

jonny B


February 1, 2008 | 1:29 pm

Looks like i’ve fixed my "white things" problem (wasn’t banging images every frame for increased performance – only movies) Seems that sometimes they ware missing the "bang a few times after loading only" i was doing.

DOH!

It’s a learning thing…

jb


February 2, 2008 | 8:38 am

Hi Jonny

glad you solved the problem – and thanks for the tip about freePeer() – I’ll give it a shot. In the meantime, I managed to get around the problem by creating the JitterMatrix only once, with dimensions big enough to handle any number of ‘particles’, and then doing a bit of filtering later to make sure I only pay attention to the first x rows.

Cheers

Tom


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