BradLarson / GPUImage

An open source iOS framework for GPU-based image and video processing
http://www.sunsetlakesoftware.com/2012/02/12/introducing-gpuimage-framework
BSD 3-Clause "New" or "Revised" License
20.24k stars 4.62k forks source link

memory problem #715

Open rschlacter opened 11 years ago

rschlacter commented 11 years ago

Hi BradLarson,

Much appreciation for a good library...

Was testing it with some filters and upon using more than a certain no. of filters and video length, it starts crashing [apparently in the opengl driver?] - the details are below. It seems likely due to memory or some resource issue, since it only happens if my program does lots of allocations and video length - can be repeated and always seems to fail at this point.

Questions:

  1. Is it possible to bail out properly when starting to run out of memory/resource instead of crashing - simply as [if some alloc 'foo' fails, raise a known exception] - so client programs can gracefully handle it however...
  2. Any other way to resolve it?

Thanks for any help,

Rob

com.sunsetlakesoftware.GPUImage.openGLESContextQueue IMGSGX543GLDriver`sgxTextureGetImageRowBytes(GLDTextureRec*, unsigned int, unsigned int): 0x385f41ac: push {r4, r5, r7, lr} Getting BAD_ACCESS here

rschlacter commented 11 years ago

BTW, using: ios6.latest on iphone4S with GPUImage.latest build

rschlacter commented 11 years ago

Update:

Have checked above is not due to over-release, etc. but the memory footprint [real mem] was of the order of 45MB [from instruments]. But if I keep it down to around 30-35MB by reducing allocations, it was running fine.

But to be safe, I changed my code/design by removing a major component and library and brought down to 22-25MB range.

But now also its failing allocation assert check in GPUImageView::createDisplayFramebuffer {... NSAssert(framebufferCreationStatus == GL_FRAMEBUFFER_COMPLETE, @"Failure with display framebuffer generation for display of size: %f, %f", self.bounds.size.width, self.bounds.size.height); }

Now this is strange - by reducing memory usage, I am failing with FBO allocation - what gives?

rschlacter commented 11 years ago

No difference with adding cautionary renderbuffer delinking in destroyFrameBuffer [[[GPUImageOpenGLESContext sharedImageProcessingOpenGLESContext] context] renderbufferStorage:GL_RENDERBUFFER fromDrawable:nil]; glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, 0);

girishvr commented 11 years ago

I am facing similar problem. I am trying to play more than one videos on a single screen. The App crashes after stating the memory warning. Did you find a solution yet?

toohtik commented 11 years ago

Hi everyone! Same problem on iPad 3 ios 6.1 I found next workaround: http://stackoverflow.com/questions/13514296/ios-6-maps-occasional-crash Possible it may help you for solving this problem.