matlab_offscreen icon indicating copy to clipboard operation
matlab_offscreen copied to clipboard

RenderColorMesh memory leak hint?

Open gailweiss opened this issue 10 years ago • 0 comments

[I am not familiar with github commenting protocol]

If you are still maintaining this code, I hope this will be of some help:

The memory leak in RenderColorMesh may be coming from improper release of the OffScreenGL created in the function.

A temporary workaround can be achieved by replacing the lines:

=================== OffscreenGL offscreenGL((int)(imgSizeV[0] * zoomFactor), (int) (imgSizeV[1] * zoomFactor)); int output3Size[3];

unsigned char *imgBuffer;

if (offscreenGL.RGB8Setup()) {

mexPrintf("OpenGLCanvas setup Successful\n");

with the lines

static OffscreenGL offscreenGL((int)(imgSizeV[0] * zoomFactor), (int) (imgSizeV[1] * zoomFactor)); static bool not_first_entry = false; int output3Size[3];

unsigned char *imgBuffer;

if (not_first_entry || offscreenGL.RGB8Setup()) { if(!not_first_entry){ mexPrintf("OpenGLCanvas setup Successful\n"); }

not_first_entry=true;

this stems the leak, though it does not fix it (X11 continues to run in the background and eventually crash if called unexpectedly)

gailweiss avatar Oct 02 '15 20:10 gailweiss