With the example code below I am loading (large) Jitter matrices and rendering these with mgraphics within jsui. My issue is, I can't find a way to free the MGraphics instance created by the mginstance function - every time i call it Max's active memory allocation increases until it crashes.
How can I explicitly call a release on this MG instance (a kind of equivalent to the freepeer() method for jitter matrices)? I could not find a clue in the docs or DG's tutorials.
Any tip or orientation would be much appreciated.
mgraphics.relative_coords = 0;
mgraphics.autofill = 0;
var inputMatrix = new JitterMatrix();
var outImage = null;
var width = (box.rect - box.rect); // clips to 2048
var height = (box.rect - box.rect); // clips to 2048
function load(val) // jxf.jit file as input
mg = new MGraphics(width, height);
outImage = new Image(mg);