“EXC_BAD_ACCESS”:Data Formatters temporarily unavailable

Hi Guys,

In the MovieGrabberExample I am performing some image processing on my Image object created as an instance of my Matrix class. I am performing a grassfire filter (a method) on the camera input to detect blobs, and as soon a pixel is “burned”, the new intensity value is set in a reference image that is then returned.

When I execute the program I get the following error(s):

movieGrabberExampleDebug(1633,0xa03f2540) malloc: *** error for object 0xbffff1a0: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
movieGrabberExampleDebug(1633,0xa03f2540) malloc: *** error for object 0xbffff190: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Program received signal: “EXC_BAD_ACCESS”.
sharedlibrary apply-load-rules all
Data Formatters temporarily unavailable, will re-try after a ‘continue’. (Not safe to call dlopen at this time.)
warning: Unable to restore previously selected frame.
warning: Could not find object file “/Users/theo/Documents/CODE/__OPENFRAMEWORKS/SANDBOX/COMPILE_LIBRARIES/buildGlutFramework/libForeground.a(macx_foreground.o)” - no debug information available for “/Users/mcast/Code/GLUT-ToPost/macx_foreground.m”.

warning: Could not find object file “/Developer/usr/lib/gcc/i686-apple-darwin9/4.0.1/libgcc.a(_eprintf.o)” - no debug information available for “/var/tmp/gcc/gcc-5493~1/src/gcc/libgcc2.c”.

When I load stack frames in the GDB it directs me to the point where I set the new pixel value in the ref image. Prior to the error it has already set thousands of other pixel values, so it is as if there is a size limit of the Matrix array?

Below is how I create my Matrix

  
private:  
	int rows;  
    int cols;  
    T ** matrix;  
      
    T ** createMatrix(const int & rows, const int & cols, const T & initValue=0){  
		T ** matrix_tmp = new T*[rows];  
		  
		for(int i=0; i<rows; i++){  
			matrix_tmp[i] = new T[cols];  
			for(int j = 0; j < cols; ++j){  
				matrix_tmp[i][j] = initValue;  
			}  
		}  
		  
		return matrix_tmp;  
	}  
      

and my Image object is the an instance of the Matrix class:

  
Image::Image(const int & width, const int & height)  
{  
	matrix = new Matrix<unsigned char>(width, height, 0); // 0 = start intensity  
	this->width = width;  
	this->height = height;  
}   
  

and finally the actual grassfire method:

  
static Image Grassfire(const Image & image, const unsigned char & blobColor){  
		Image output = Image(image);  
		int pixelCounter = 0;  
		int minX = output.getWidth();  
		int minY = output.getHeight();  
		int maxX, maxY = 0;  
		  
		for (int i = Calibration::Instance()->getMinY(); i < Calibration::Instance()->getMaxY(); i++){  
			for (int j = 0; j < output.getWidth(); j++) {  
				pixelCounter = 0;  
				minX = output.getWidth();  
				minY = output.getHeight();  
				maxX = 0;  
				maxY = 0;  
				  
				// Run recursion on white pixels  
				if(output.getPixel(j, i) == 255){  
					recursiveFire(i, j, output, blobColor, pixelCounter, minX, minY, maxX, maxY);  
				}  
				// Feature matching  
				evaluateBlob(minX, minY, maxX, maxY, pixelCounter);  
			}  
		}  
		return output;  
		delete &output;  
	}  
  

And it is from inside “recursiveFire” that it runs through each pixel and sets the “burned” pixels with: output.setPixel(x, y, blobColor);

Is there a problem with the way I create my image Matrix (e.g. a size limit since it suddenly isn’t able to stops at the “setPixel” method), or am I doing something else wrong?

Hope that you can help,
Thx.