memory issues with JitterMatrix()

Jul 10, 2006 at 8:27pm

memory issues with JitterMatrix()

Hi Everybody,

I am experiencing what may be a memory leak when creating JitterMatrix objects, consider the following code

private int[]testArr = new int[200 * 200];
private BufferedImage outTestBuf = new BufferedImage(200,200, BufferedImage.TYPE_BYTE_BINARY);

private void testOutput(){

//create a BufferedImage from the array
outTestBuf.setRGB(0, 0, 200, 200, testArr, 0, 200);
//turn it into a jitter matrix and output it
JitterMatrix outTest = new JitterMatrix(outTestBuf);
outlet(0, “jit_matrix”, outTest.getName());

}

testArr is randomly filled with values for black and white upon construction of the object. The method testOutput() is called from the bang() method. When i connect a metro (or qmetro) to the mxj object and run it, the amount of memory max uses starts growing quite fast, and max very soon crashes.

Even when i comment out the line that copies the array into the BufferedImage and use the no argument constructor for Jittermatrix, the memory use still grows continually (albeit much more slowly).

Any help would be much appreciated, i am running this on max 4.5.7 and jitter 1.5.2 on Max OSX and was using the activity monitor to see the memory usage of max.

Another related question is whether what i am doing is the best way to convert an array into a matrix? I am fairly new to the jitter/java api and didn’t see anything to directly copy an array into a matrix and thus i took the buffered image route. I also use a buffered image as an intermediary in converting input matrices into arrays for processing.

Thanks in advance
Yannick Assogba

#26748
Jul 10, 2006 at 8:39pm

On Jul 10, 2006, at 1:27 PM, Yannick Assogba wrote:

> I am experiencing what may be a memory leak when creating
> JitterMatrix objects, consider the following code
>
> private int[]testArr = new int[200 * 200];
> private BufferedImage outTestBuf = new BufferedImage(200,200,
> BufferedImage.TYPE_BYTE_BINARY);
>
> private void testOutput(){
>
> //create a BufferedImage from the array
> outTestBuf.setRGB(0, 0, 200, 200, testArr, 0, 200);
> //turn it into a jitter matrix and output it
> JitterMatrix outTest = new JitterMatrix(outTestBuf);
> outlet(0, “jit_matrix”, outTest.getName());
>
> }

This is because Java doesn’t know about the Native memory to run the
garbage collector fast enough (the Java Object is small, the native C
peer is *large*). You will want to call JitterMatrix.freepeer() to
free any C resources which are not handled fast enough by the Garbage
collector.

> Another related question is whether what i am doing is the best way
> to convert an array into a matrix? I am fairly new to the jitter/
> java api and didn’t see anything to directly copy an array into a
> matrix and thus i took the buffered image route. I also use a
> buffered image as an intermediary in converting input matrices into
> arrays for processing.

Check out JItterMatrix.CopyArrayToVector() and
JitterMatrix.CopyVectorToArray()

In JItter 1.6, there’s a new method for filling more than a row or
column at a time.

-Joshua

#80337
Jul 10, 2006 at 9:43pm

I modified my method to call freepeer in the following manner

JitterMatrix outTest;
private void testOutput(){
if(outTest != null)
outTest.freePeer();
//create a BufferedImage from the array
outTestBuf.setRGB(0, 0, 200, 200, testArr, 0, 200);
outTest = new JitterMatrix(outTestBuf);
outlet(0, “jit_matrix”, outTest.getName());
}

I had tried calling freepeer after the matrix was output, but it apparently gets destroyed before the jit.window in the patch has time to render it (jit.window gave the following error • error: jit.window: couldn’t get matrix object!). So instead i free the peer just before discarding the old object and creating a new JitterMatrix (and after the old one has been rendered). However the memory consumption of max grew just as before, although the patch ran for much longer before crashing (the total memory it used was much higher). I even tried calling System.gc() at the end of the method but that had no effect.

>> Check out JItterMatrix.CopyArrayToVector() and
>> JitterMatrix.CopyVectorToArray()

I had seen these methods before but must admit i could not figure out how to use them. What is exactly is a vector in a jitter matrix, is it a row or a column? In particular the first two arguments to copyArrayToVector are unclear to me, the first, “dim” i guess is the length of the coloumn or row (which is either the width or the height of the matrix). The second argument, “offset”, confuses me, why is it an array? i would have thought it would be an int to specify which row or coloumn you want to copy into. How should i specifiy an offset?

Thanks
Yannick

#80338
Jul 10, 2006 at 10:46pm

On Jul 10, 2006, at 2:43 PM, Yannick Assogba wrote:

>
> I had tried calling freepeer after the matrix was output, but it
> apparently gets destroyed before the jit.window in the patch has
> time to render it (jit.window gave the following error •
> error: jit.window: couldn’t get matrix object!). So instead i free
> the peer just before discarding the old object and creating a new
> JitterMatrix (and after the old one has been rendered). However the
> memory consumption of max grew just as before, although the patch
> ran for much longer before crashing (the total memory it used was
> much higher). I even tried calling System.gc() at the end of the
> method but that had no effect.

If you could provide us with a simple, complete example, we can
perhaps offer you more feedback.

> I had seen these methods before but must admit i could not figure
> out how to use them. What is exactly is a vector in a jitter
> matrix, is it a row or a column?

It can be a row (dim argument =0), or column(dim argument=1), or
vector across any other dimensions(dim=N). It can also be any portion
of a complete row, column, or vector across N-D.

> In particular the first two arguments to copyArrayToVector are
> unclear to me, the first, “dim” i guess is the length of the
> coloumn or row (which is either the width or the height of the
> matrix).

No it is *which* dimension in the N-dimensional Jitter Matrix, *not*
the size of the dimension. The “count” parameter determines how many
elements to copy.

> The second argument, “offset”, confuses me, why is it an array?

It is the offset for every dimension in the N-dimensional
JitterMatrix at which to start copying. So if you want to do a whole
row for row 13 (zero based of course), it would be dim=0, offset[0] =
0, and offset[1] = 13. If you wanted to just copy 4 elements into row
13 starting at column 27, it would be offset[0] = 27, and offset[1] =
13.

So in summary, the important things to understand this are:

1. a jitter Matrix can have up to 32 dimensions
2. a vector in a jitter matrix can be across any one of these
dimensions (specified by the dim argument)
3. this function can copy to any length vector in the Matrix (doesn’t
need to be the whole row, col, etc. length)
4. the offset parameter is an offset for every dimension in the matrix
5. this function can copy only part of the input array, as defined by
count and arrayoffset

However, it sounds like you don’t need much more than the example
usage inside jitvectorprocess.java. Which just does every complete
row, one at a time. Source below for your convenience.

public void jit_matrix(String inname)
{
int[] dim;
int[] offset = new int[2];
int width;
int height;
int planecount;
int i,j,k,n;
JitterMatrix inmat = new JitterMatrix(inname);

mat.setinfo(inname);
dim = mat.getDim();
planecount = mat.getPlanecount();
// only alloc vec if size is different
if ((vec==null)||(vec.length!=(dim[0]*planecount)))
vec = new int[dim[0]*planecount];

width = dim[0];
height = dim[1];
offset[0] = 0;

for (i=0;i
offset[1] = i;
inmat.copyVectorToArray(0,offset,vec,vec.length,0);
if (planecount==4) {
for (j=0,k=0;j
vec[k] = 255-vec[k++];
vec[k] = 255-vec[k++];
vec[k] = 255-vec[k++];
vec[k] = 255-vec[k++];
}
} else {
for (j=0,k=0;j
for (n=0;n

vec[k] = 255-vec[k];
}
}
}
mat.copyArrayToVector(0,offset,vec,vec.length,0);
}
outlet(0,”jit_matrix”, mat.getAttr(“name”));
}

Hope this helps.

-Joshua

#80339
Jul 11, 2006 at 9:30pm

>>If you could provide us with a simple, complete example, we can
perhaps offer you more feedback.

I have attached a zip file containing a patch and java files (.class and src) with an example. When i run the patch, activity monitor shows the memory used by max going higher and higher, takes about 8 minutes to crash.

Thanks for the stuff on copyArrayToVector, i get it now, i will try the code in jitvectorprocess.java a bit later.

Thanks
Yannick

#80340
Jul 11, 2006 at 9:32pm

hmmm, attachment diidnt seem to work…

here is the patch

max v2;
#N vpatcher 59 359 814 916;
#P toggle 159 43 15 0;
#P window setfont “Sans Serif” 9.;
#P message 322 118 70 196617 size 300 300;
#P user jit.pwindow 160 175 302 302 0 1 0 0 1 0;
#P newex 159 78 52 196617 metro 20;
#P newex 160 112 121 196617 mxj ya_jitTest 300 300;
#P connect 4 0 1 0;
#P connect 1 0 0 0;
#P connect 0 0 2 0;
#P connect 3 0 2 0;
#P pop;

and here is the java code

import java.awt.Color;
import java.awt.image.BufferedImage;

import com.cycling74.jitter.JitterMatrix;
import com.cycling74.max.MaxObject;

/**
*
* @author Yannick Assogba
*
* Test converting an integer array into a jitter matrix and outputting it to
* max
*
*/

public class ya_jitTest extends MaxObject {

private int width;
private int height;

private int[]testArr;
private BufferedImage outTestBuf;

private int blackCol = new Color(0,0,0).getRGB();
private int whiteCol = new Color(255,255,255).getRGB();

public ya_jitTest(){
bail(“must provide dimensions”);
}

public ya_jitTest(int width, int height){
this.width = width;
this.height = height;

testArr = new int[width * height];
outTestBuf = new BufferedImage(width,height, BufferedImage.TYPE_BYTE_BINARY);

post(“ya_jitTest object created”);
}

public void bang()
{
initTestArr();
output();
}

//simulation goes here – in this case, simple noise field is generated
private void initTestArr(){
for (int j = 0; j < testArr.length; j++) {
if (Math.random() < 0.5)
testArr[j] = whiteCol;
else
testArr[j] = blackCol;
}
}

JitterMatrix outTest;
private void output(){
//free the peer created on the last bang
if(outTest != null)
outTest.freePeer();
//create a BufferedImage from the array
outTestBuf.setRGB(0, 0, width, height, testArr, 0, width);
outTest = new JitterMatrix(outTestBuf);
outlet(0, “jit_matrix”, outTest.getName());
}

}

#80341
Jul 11, 2006 at 9:39pm

Hi Yannick,

Rather than creating a new matrix every time in your output method,
instead try using JitterMatrix’s copyBufferedImage method.

Ben

On 7/11/06, Yannick Assogba wrote:
>
> hmmm, attachment diidnt seem to work…
>
> here is the patch
>
> max v2;
> #N vpatcher 59 359 814 916;
> #P toggle 159 43 15 0;
> #P window setfont “Sans Serif” 9.;
> #P message 322 118 70 196617 size 300 300;
> #P user jit.pwindow 160 175 302 302 0 1 0 0 1 0;
> #P newex 159 78 52 196617 metro 20;
> #P newex 160 112 121 196617 mxj ya_jitTest 300 300;
> #P connect 4 0 1 0;
> #P connect 1 0 0 0;
> #P connect 0 0 2 0;
> #P connect 3 0 2 0;
> #P pop;
>
> and here is the java code
>
> import java.awt.Color;
> import java.awt.image.BufferedImage;
>
> import com.cycling74.jitter.JitterMatrix;
> import com.cycling74.max.MaxObject;
>
> /**
> *
> * @author Yannick Assogba
> *
> * Test converting an integer array into a jitter matrix and outputting it to
> * max
> *
> */
>
> public class ya_jitTest extends MaxObject {
>
> private int width;
> private int height;
>
> private int[]testArr;
> private BufferedImage outTestBuf;
>
> private int blackCol = new Color(0,0,0).getRGB();
> private int whiteCol = new Color(255,255,255).getRGB();
>
> public ya_jitTest(){
> bail(“must provide dimensions”);
> }
>
> public ya_jitTest(int width, int height){
> this.width = width;
> this.height = height;
>
> testArr = new int[width * height];
> outTestBuf = new BufferedImage(width,height, BufferedImage.TYPE_BYTE_BINARY);
>
> post(“ya_jitTest object created”);
> }
>
> public void bang()
> {
> initTestArr();
> output();
> }
>
> //simulation goes here – in this case, simple noise field is generated
> private void initTestArr(){
> for (int j = 0; j < testArr.length; j++) {
> if (Math.random() < 0.5)
> testArr[j] = whiteCol;
> else
> testArr[j] = blackCol;
> }
> }
>
>
> JitterMatrix outTest;
> private void output(){
> //free the peer created on the last bang
> if(outTest != null)
> outTest.freePeer();
> //create a BufferedImage from the array
> outTestBuf.setRGB(0, 0, width, height, testArr, 0, width);
> outTest = new JitterMatrix(outTestBuf);
> outlet(0, “jit_matrix”, outTest.getName());
> }
>
> }
>
>

#80342
Jul 11, 2006 at 10:01pm

>>
Hi Yannick,

Rather than creating a new matrix every time in your output method,
instead try using JitterMatrix’s copyBufferedImage method.

Ben
< <

Just tried that, no change.

Yannick

#80343
Jul 11, 2006 at 10:26pm

The first thing I notice is that your patch uses a metronome (High
Priority Scheduler).

> #P newex 159 78 52 196617 metro 20;

First of all, it is not recommended unless you really know what
you’re doing to use Jitter objects in the High Priority thread (i.e.
are issuing no drawing calls, and know that the calculations can
happen in realtime, and do not exploit matrices which are also being
used at low priority at the same time, leading to threading conflicts).

More importantly, there is not the automatic usurp mechanism for Java
objects which happens for C programmed Jitter objects, which if
attempting to execute an operation faster than possible to compute in
real-time, messages are dropped to prevent scheduler backlog. In your
patch, if it can’t compute in realtime, you will allocate memory for
a new event, which grows without bound, and once memory is completely
exhausted, the program will crash.

Since this could be your problem, the way this patch is programmed,
the first thing I would try is to use the low priority, and backlog
safe qmetro object (as is done in almost all Java and Javascript
example patches). For a detailed discussion of scheduler and low
priority issues, I would read the following articles:

“Event Priority in Max (Scheduler vs. Queue)”

http://www.cycling74.com/story/2005/5/2/133649/9742

The Jitter C programming Guide chapter “Scheduler and Low Priority
Queue Issue”
http://www.cycling74.com/twiki/bin/view/ProductDocumentation/
JitterSdkSchedQueue

Let us know if you change your patch and you are still suffering from
the same problems, and we can investigate further.

-Joshua

#80344
Jul 11, 2006 at 10:32pm

Hi Yannick,

I have found what may be a memory leak in the C/Java bindings. For
now, please use copyArrayToVector or similar as was suggested by
Joshua.

Ben

On 7/11/06, Yannick Assogba wrote:
>
> >>
> Hi Yannick,
>
> Rather than creating a new matrix every time in your output method,
> instead try using JitterMatrix’s copyBufferedImage method.
>
> Ben
> < <
>
> Just tried that, no change.
>
> Yannick
>

#80345
Jul 11, 2006 at 10:42pm

>>

Let us know if you change your patch and you are still suffering from
the same problems, and we can investigate further.

< <

I tried it with qmetro with no difference.

Yannick

#80346
Jul 12, 2006 at 11:51pm

Hi,

So i have changed my code to use the copyArrayToVectorMethod and in doing so came accross something quite curious.

The following code

//listing 1

import java.awt.Color;
import java.awt.image.BufferedImage;

import com.cycling74.jitter.JitterMatrix;
import com.cycling74.max.MaxObject;

/**
*
* @author Yannick Assogba
*
* Test converting an integer array into a jitter matrix and outputting it to
* max
*
*/

public class ya_jitTest4Plane extends MaxObject {

private int width;
private int height;

private int[]testArr;

private int blackCol = 0;
private int whiteCol = 255;

JitterMatrix outTest;

public ya_jitTest4Plane(){
bail(“must provide dimensions”);
}

public ya_jitTest4Plane(int width, int height){
this.width = width;
this.height = height;

testArr = new int[width * height];

outTest = new JitterMatrix(4, “char”, width, height);

post(“ya_jitTest4plane object created”);
}

public void bang()
{
initTestArr();
outPutArrayAsMatrix(testArr, outTest);
}

//simulation goes here – in this case, simple noise field is generated
private void initTestArr(){
for (int j = 0; j < testArr.length; j++) {
if (Math.random() < 0.5)
testArr[j] = whiteCol;
else
testArr[j] = blackCol;
}
}

int[] vec = null;
private void outPutArrayAsMatrix(int[] src, JitterMatrix dest){
int[] offset = new int[2];
int planecount = dest.getPlanecount();
int[] dim = dest.getDim();

// only alloc vec if size is different
if ((vec==null)||(vec.length!=(dim[0]*planecount)))
vec = new int[dim[0]*planecount];

int count = 0;
offset[0] = 0;
for (int i=0;i
offset[1] = i;
for (int j=0,k=0;j
vec[k] = 255;
vec[k+1] = src[count];
vec[k+2] = src[count];
vec[k+3] = src[count];
count++;
}
dest.copyArrayToVector(0, offset, vec, vec.length, 0);
}
outlet(0,”jit_matrix”, dest.getName());
}
}

//end listing 1

runs faster than

//listing 2

import java.awt.Color;
import java.awt.image.BufferedImage;

import com.cycling74.jitter.JitterMatrix;
import com.cycling74.max.MaxObject;

/**
*
* @author Yannick Assogba
*
* Test converting an integer array into a jitter matrix and outputting it to
* max
*
*/

public class ya_jitTest1Plane extends MaxObject {

private int width;
private int height;

private int[]testArr;

private int blackCol = 0;
private int whiteCol = 255;

JitterMatrix outTest;

public ya_jitTest1Plane(){
bail(“must provide dimensions”);
}

public ya_jitTest1Plane(int width, int height){
this.width = width;
this.height = height;
testArr = new int[width * height];
outTest = new JitterMatrix(1, “char”, width, height);
post(“ya_jitTest1Plane object created”);
}

public void bang()
{
initTestArr();
copyArrayToMatrix(testArr, outTest);
}

//simulation goes here – in this case, simple noise field is generated
private void initTestArr(){
for (int j = 0; j < testArr.length; j++) {
if (Math.random() < 0.5)
testArr[j] = whiteCol;
else
testArr[j] = blackCol;
}
}

private void copyArrayToMatrix(int[] src, JitterMatrix dest){
int[] offset = new int[2];

offset[0] = 0;
for (int i=0;i
offset[1] = i;
dest.copyArrayToVector(0, offset, src, width, width * i);
}
outlet(0,”jit_matrix”, dest.getName());
}
}

// end listing two

and here is a patch to demonstrate

#P toggle 437 109 15 0;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P message 610 180 70 196617 size 300 300;
#P user jit.pwindow 437 264 302 302 0 1 0 0 1 0;
#P newex 437 144 57 196617 qmetro 20;
#P newex 438 178 151 196617 mxj ya_jitTest1Plane 300 300;
#P toggle 70 112 15 0;
#P message 243 183 70 196617 size 300 300;
#P user jit.pwindow 70 267 302 302 0 1 0 0 1 0;
#P newex 70 147 57 196617 qmetro 20;
#P newex 71 181 151 196617 mxj ya_jitTest4Plane 300 300;
#P connect 8 0 7 0;
#P connect 5 0 7 0;
#P connect 6 0 5 0;
#P connect 9 0 6 0;
#P connect 3 0 2 0;
#P connect 0 0 2 0;
#P connect 1 0 0 0;
#P connect 4 0 1 0;
#P window clipboard copycount 10;

I would have expected the opposite, the only difference i can perceive between the two classes is that one outputs a 4 plane matrix and the other outputs a 1 plane matrix. In filling the 4 plane matrix the former does more work than the other, yet runs considerably faster. Can anybody shed some light onto why this is so?

Thanks
Yannick

#80347
Jul 13, 2006 at 1:47am

Hi Yannick,

The second class is slower because you are passing the entire src
array to the copyArrayToVector function, whereas in the first class
you are first copying elements to a smaller array and passing that.
copyArrayToVector calls a native method – looks like in the transition
between Java and C it actually copies all the arguments to new places
in memory.

Ben

On 7/12/06, Yannick Assogba wrote:
>
> Hi,
>
> So i have changed my code to use the copyArrayToVectorMethod and in doing so came accross something quite curious.
>
> The following code
>
> //listing 1
>
> import java.awt.Color;
> import java.awt.image.BufferedImage;
>
> import com.cycling74.jitter.JitterMatrix;
> import com.cycling74.max.MaxObject;
>
> /**
> *
> * @author Yannick Assogba
> *
> * Test converting an integer array into a jitter matrix and outputting it to
> * max
> *
> */
>
> public class ya_jitTest4Plane extends MaxObject {
>
> private int width;
> private int height;
>
> private int[]testArr;
>
> private int blackCol = 0;
> private int whiteCol = 255;
>
> JitterMatrix outTest;
>
> public ya_jitTest4Plane(){
> bail(“must provide dimensions”);
> }
>
> public ya_jitTest4Plane(int width, int height){
> this.width = width;
> this.height = height;
>
> testArr = new int[width * height];
>
> outTest = new JitterMatrix(4, “char”, width, height);
>
> post(“ya_jitTest4plane object created”);
> }
>
> public void bang()
> {
> initTestArr();
> outPutArrayAsMatrix(testArr, outTest);
> }
>
> //simulation goes here – in this case, simple noise field is generated
> private void initTestArr(){
> for (int j = 0; j < testArr.length; j++) {
> if (Math.random() < 0.5)
> testArr[j] = whiteCol;
> else
> testArr[j] = blackCol;
> }
> }
>
> int[] vec = null;
> private void outPutArrayAsMatrix(int[] src, JitterMatrix dest){
> int[] offset = new int[2];
> int planecount = dest.getPlanecount();
> int[] dim = dest.getDim();
>
> // only alloc vec if size is different
> if ((vec==null)||(vec.length!=(dim[0]*planecount)))
> vec = new int[dim[0]*planecount];
>
> int count = 0;
> offset[0] = 0;
> for (int i=0;i
> offset[1] = i;
> for (int j=0,k=0;j
> vec[k] = 255;
> vec[k+1] = src[count];
> vec[k+2] = src[count];
> vec[k+3] = src[count];
> count++;
> }
> dest.copyArrayToVector(0, offset, vec, vec.length, 0);
> }
> outlet(0,”jit_matrix”, dest.getName());
> }
> }
>
> //end listing 1
>
> runs faster than
>
> //listing 2
>
> import java.awt.Color;
> import java.awt.image.BufferedImage;
>
> import com.cycling74.jitter.JitterMatrix;
> import com.cycling74.max.MaxObject;
>
> /**
> *
> * @author Yannick Assogba
> *
> * Test converting an integer array into a jitter matrix and outputting it to
> * max
> *
> */
>
> public class ya_jitTest1Plane extends MaxObject {
>
> private int width;
> private int height;
>
> private int[]testArr;
>
> private int blackCol = 0;
> private int whiteCol = 255;
>
> JitterMatrix outTest;
>
> public ya_jitTest1Plane(){
> bail(“must provide dimensions”);
> }
>
> public ya_jitTest1Plane(int width, int height){
> this.width = width;
> this.height = height;
> testArr = new int[width * height];
> outTest = new JitterMatrix(1, “char”, width, height);
> post(“ya_jitTest1Plane object created”);
> }
>
> public void bang()
> {
> initTestArr();
> copyArrayToMatrix(testArr, outTest);
> }
>
> //simulation goes here – in this case, simple noise field is generated
> private void initTestArr(){
> for (int j = 0; j < testArr.length; j++) {
> if (Math.random() < 0.5)
> testArr[j] = whiteCol;
> else
> testArr[j] = blackCol;
> }
> }
>
> private void copyArrayToMatrix(int[] src, JitterMatrix dest){
> int[] offset = new int[2];
>
> offset[0] = 0;
> for (int i=0;i
> offset[1] = i;
> dest.copyArrayToVector(0, offset, src, width, width * i);
> }
> outlet(0,”jit_matrix”, dest.getName());
> }
> }
>
>
> // end listing two
>
>
> and here is a patch to demonstrate
>
> #P toggle 437 109 15 0;
> #P window setfont “Sans Serif” 9.;
> #P window linecount 1;
> #P message 610 180 70 196617 size 300 300;
> #P user jit.pwindow 437 264 302 302 0 1 0 0 1 0;
> #P newex 437 144 57 196617 qmetro 20;
> #P newex 438 178 151 196617 mxj ya_jitTest1Plane 300 300;
> #P toggle 70 112 15 0;
> #P message 243 183 70 196617 size 300 300;
> #P user jit.pwindow 70 267 302 302 0 1 0 0 1 0;
> #P newex 70 147 57 196617 qmetro 20;
> #P newex 71 181 151 196617 mxj ya_jitTest4Plane 300 300;
> #P connect 8 0 7 0;
> #P connect 5 0 7 0;
> #P connect 6 0 5 0;
> #P connect 9 0 6 0;
> #P connect 3 0 2 0;
> #P connect 0 0 2 0;
> #P connect 1 0 0 0;
> #P connect 4 0 1 0;
> #P window clipboard copycount 10;
>
>
> I would have expected the opposite, the only difference i can perceive between the two classes is that one outputs a 4 plane matrix and the other outputs a 1 plane matrix. In filling the 4 plane matrix the former does more work than the other, yet runs considerably faster. Can anybody shed some light onto why this is so?
>
> Thanks
> Yannick
>
>

#80348
Aug 22, 2006 at 1:15pm

Hello,

I have a simple patch with an mxj object generating jitter objects.
The patch and the mxj class work without any problem.
But everytime when I recompile this java class and try to re-instantiate
this recompiled class the Max app crashes. After restarting Max it works.
The zap message doesn’t help – same behavior with or without sending zap to
mxj before.
So if I recompile this class I need also to quit and restart Max !

MacBookPro 2.16 GHz
MaxMSP 4.6, Jitter 1.6.0
OSX 10.4.7
Xcode 2.3
Java 1.5.0_06

Any help?

Thanks

Andre

————————————————–
Andre Bartetzki
http://www.bartetzki.de
mailto:andre@bartetzki.de

Tel +49-(0)30-92375877
VoIP +49-(0)30-38108677
Fax +49-(0)30-38108678
UMS +49-(0)941-599214065 (Voice, Fax, SMS)
Skype bartetzki

————————————————–

#80349
Aug 22, 2006 at 4:11pm

Sorry Andre, but I’d need to see the class in question to know what’s
going on. This is the first time I’ve heard of Max crashing because
of a recompiled java class.

Ben

On 8/22/06, Andre Bartetzki wrote:
> Hello,
>
> I have a simple patch with an mxj object generating jitter objects.
> The patch and the mxj class work without any problem.
> But everytime when I recompile this java class and try to re-instantiate
> this recompiled class the Max app crashes. After restarting Max it works.
> The zap message doesn’t help – same behavior with or without sending zap to
> mxj before.
> So if I recompile this class I need also to quit and restart Max !
>
> MacBookPro 2.16 GHz
> MaxMSP 4.6, Jitter 1.6.0
> OSX 10.4.7
> Xcode 2.3
> Java 1.5.0_06
>
>
> Any help?
>
>
> Thanks
>
> Andre
>
>
> ————————————————–
> Andre Bartetzki
> http://www.bartetzki.de
> mailto:andre@bartetzki.de
>
> Tel +49-(0)30-92375877
> VoIP +49-(0)30-38108677
> Fax +49-(0)30-38108678
> UMS +49-(0)941-599214065 (Voice, Fax, SMS)
> Skype bartetzki
>
> ————————————————–
>
>
>

#80350
Aug 22, 2006 at 7:15pm

Es war der 22.08.2006 18:11 Uhr, als Ben Nevile nicht widerstehen konnte,
folgende Gedanken dem Netz anzuvertrauen:

> Sorry Andre, but I’d need to see the class in question to know what’s
> going on. This is the first time I’ve heard of Max crashing because
> of a recompiled java class.

Hi Ben,

I’ve found a cause for that crash:
Because of strange problems with the jam tool (I got always -1 errors during
the build) I deleted the last script in the Xcode project which is meant for
removing the build folder as the last Build Phase (rm – r build). After the
removal of this script the build process ran fine.
But for some reasons the contents of the remaining build folder must have
disturbed Max during the re-instantiation of the recompiled class for every
first try. Why? – maybe the problem is that I have the Xcode project in a
subfolder of the folder of my patch ?
Now I have reinstalled that script in the project and everything works: the
jam tool does not complain and Max accepts the recompiled classes.

I don’t understand why the build folder needs to be removed at all?

BTW, I derived my Xcode project from the HelloWorld example in
“java-doc/ide/Xcode/”. There were wrong paths in the target settings in this
example: “/Library/Application Support/Cycling ’74/java/…”
As of MaxMSP 4.6 this must be “Applications/MaxMSP 4.6/Cycling ’74/java/…”
or something like that, right?

Andre

————————————————–
Andre Bartetzki
http://www.bartetzki.de
mailto:andre@bartetzki.de

Tel +49-(0)30-92375877
VoIP +49-(0)30-38108677
Fax +49-(0)30-38108678
UMS +49-(0)941-599214065 (Voice, Fax, SMS)
Skype bartetzki

————————————————–

#80351
Aug 23, 2006 at 12:59am

> BTW, I derived my Xcode project from the HelloWorld example in
> “java-doc/ide/Xcode/”. There were wrong paths in the target settings in this
> example: “/Library/Application Support/Cycling ’74/java/…”
> As of MaxMSP 4.6 this must be “Applications/MaxMSP 4.6/Cycling ’74/java/…”
> or something like that, right?

Yes, I should update this example project to reflect the new Max
directory structure. Thanks for the reminder.

Ben

#80352
Aug 25, 2006 at 8:54am

#80353
Aug 25, 2006 at 1:02pm

On 06-08-25, at 0554, Andre Bartetzki wrote:
> Could it be that classes compiled in a java 1.5 environment can’t
> run with
> 1.4 ???
>
sort of yes. if you target 1.4 when you build, then it’s fine to
build in a 1.5 environment, but if you use 1.5 language features and
output 1.5 bytecode, then it won’t work.

I’m not sure 10.3.x supports java 1.5. check the apple website.

r.

#80354
Aug 25, 2006 at 1:21pm

Es war der 25.08.2006 15:02 Uhr, als ritchie nicht widerstehen konnte,
folgende Gedanken dem Netz anzuvertrauen:

> On 06-08-25, at 0554, Andre Bartetzki wrote:
>> Could it be that classes compiled in a java 1.5 environment can’t
>> run with
>> 1.4 ???
>>
> sort of yes. if you target 1.4 when you build, then it’s fine to
> build in a 1.5 environment, but if you use 1.5 language features and
> output 1.5 bytecode, then it won’t work.

Hmm, I didn’t use 1.5 language features, just the unaltered HelloWorld
example.
I guess, the bytecode version is determined with the “Target VM version” in
the Java Compiler Settings in Xcode?
There the version is “unspecified”.
Should I specify something (1.4) ??

Andre

————————————————–
Andre Bartetzki
http://www.bartetzki.de
mailto:andre@bartetzki.de

Tel +49-(0)30-92375877
VoIP +49-(0)30-38108677
Fax +49-(0)30-38108678
UMS +49-(0)941-599214065 (Voice, Fax, SMS)
Skype bartetzki

————————————————–

#80355
Aug 25, 2006 at 8:09pm

1.5 compiled classes wont run on a 1.4 jvm to the best of my knowledge.
topher

On Aug 25, 2006, at 06:21 AM, Andre Bartetzki wrote:

> Es war der 25.08.2006 15:02 Uhr, als ritchie nicht widerstehen konnte,
> folgende Gedanken dem Netz anzuvertrauen:
>
>> On 06-08-25, at 0554, Andre Bartetzki wrote:
>>> Could it be that classes compiled in a java 1.5 environment can’t
>>> run with
>>> 1.4 ???
>>>
>> sort of yes. if you target 1.4 when you build, then it’s fine to
>> build in a 1.5 environment, but if you use 1.5 language features and
>> output 1.5 bytecode, then it won’t work.
>
> Hmm, I didn’t use 1.5 language features, just the unaltered HelloWorld
> example.
> I guess, the bytecode version is determined with the “Target VM
> version” in
> the Java Compiler Settings in Xcode?
> There the version is “unspecified”.
> Should I specify something (1.4) ??
>
>
> Andre
>
> ————————————————–
> Andre Bartetzki
> http://www.bartetzki.de
> mailto:andre@bartetzki.de
>
> Tel +49-(0)30-92375877
> VoIP +49-(0)30-38108677
> Fax +49-(0)30-38108678
> UMS +49-(0)941-599214065 (Voice, Fax, SMS)
> Skype bartetzki
>
> ————————————————–
>
>

#80356

You must be logged in to reply to this topic.