We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOpenGL and 3D Libraries › Freeing memory in opengl
Page Index Toggle Pages: 1
Freeing memory in opengl (Read 696 times)
Freeing memory in opengl
Mar 21st, 2006, 6:55pm
 
Hi there!
Does anibody know how to free memory in opengl? We've problem at working with PImage and declaring new images.

So, this code:
Code:

PImage img;
void setup(){
size(800,600);
img=new PImage(width,height);
}

void keyPressed(){
img=null;
img=new PImage(width,height);
}

Keeps memory RAM stable, but the same with OPENGL:

Code:

PImage img;
void setup(){
size(800,600,OPENGL);
img=new PImage(width,height);
}

void keyPressed(){
img=null;
img=new PImage(width,height);
}

Increases memory ram everytime we do a new PImage, and the memory doesn't flush.
Re: Freeing memory in opengl
Reply #1 - Mar 21st, 2006, 8:15pm
 
it should eventually free itself, but it's a known bug and is slated to be fixed within the next few weeks..
http://dev.processing.org/bugs/show_bug.cgi?id=150
Re: Freeing memory in opengl
Reply #2 - Mar 22nd, 2006, 11:20am
 
Mmmm.... very big problem...

Do you know anyway to do a manual call to memory flush?
We've tried doing a System.gc(); but it's useless...


We've also tried (as you previously said in another thread) reusing the imagevar and doing an updatePixels before displaying the image and yes, it works but we have lots of "big" images and it drops framerate to 10 - 15 wich is realy bad.

Thanks once again!
Re: Freeing memory in opengl
Reply #3 - Mar 22nd, 2006, 3:12pm
 
setting an object to null removes any references to it and should mark it for deletion by the gc. it would seem that jogl is keeping the references around for the texture binding, which wouldn't be as much of a problem except for how things are currently implemented making it really bad. i'm trying to get it fixed asap.
Page Index Toggle Pages: 1