Has anyone come accross this jitter java error?

Mark's icon

In one of my projects I am getting very irregularly following error:

jit_java_jitobj_new: error trying to register object

All I do with jitter in java is to create initially a couple of JitterMatrix object, using something like

jm[h] = new JitterMatrix(h + matrixName, 13, "float32", new int[] {coord[0].length, 1 });

Afterwards I resize the matrices and send them to several jit.gl.mesh objects. This happens every frame.

For resizing the matrices I use something similar to:

jm[h].setDim(new int[] { coord[0].length, 1 })

Any idea?

Joshua Kit Clayton's icon

Hi Mark,

This looks like a problem in our object registration code where we
may be failing in the instance we try to register objects with the
same name or object pointer before they have been garbage collected.

The first solution would be to only create these matrices once. this
will be noticeably more efficient than creating every frame. However
if you need to create these matrices each frame, or dynamically, I
would recommend using the freepeer() method on JitterMatrix. This
will also save you some memory usage bloat that can happen as the GC
waits to collect objects.

Let us know if you still have problems, and please provide a simple
but complete example which illustrates your problem with detailed
platform and software version info.

-Joshua

Mark's icon

Hi Joshua,

thanks for your advise. Actually the way I did it with resizing the matrix using jm.setDim() works now fine without causing any errors.

I think the mentioned errors mainly occur when using too frequently the constructor JitterMatrix(java.lang.String name) to resize matrices within Java.

Cheers

Mark