gauthiier/RefractiveIndex — Issue #7: windows saving trick bombs memory
Author: gauthiier
Created: 2012-02-25 15:22:19+00:00
State: open

the windows saving loop (in save_cb) shoot memory off the roof!

i've been profiling with OSX and memory keeps on shooting up - which could explain the "freeze" of the application after 10 minutes on windows.

unsigned char * somePixels;
ofPixels appPix = RefractiveIndex::_pixels;
somePixels = new unsigned char [appPix.getWidth()*appPix.getHeight()*3];
somePixels = appPix.getPixels();

ofImage myImage;
//myImage.allocate(appPix.getWidth(),appPix.getHeight(), OF_IMAGE_COLOR);

//his needs to be here for OSX of we get a BAD ACCESS ERROR. DOES IT BREAK WINDOWS? //
myImage.setUseTexture(false);

myImage.setFromPixels(somePixels,appPix.getWidth(),appPix.getHeight(), OF_IMAGE_COLOR);
myImage.saveImage(ofToDataPath("")+ _whole_file_path_analysis+"/"+file_name);

trying to fix this with "delete somePixels;" yet not conclusive...