Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak ZXBinaryBitmap and ZXQRCodeReader. #33

Closed
andrioli opened this issue Feb 1, 2013 · 1 comment
Closed

Memory leak ZXBinaryBitmap and ZXQRCodeReader. #33

andrioli opened this issue Feb 1, 2013 · 1 comment

Comments

@andrioli
Copy link

andrioli commented Feb 1, 2013

I think there is a memory leak at ZXBinaryBitmap and ZXQRCodeReader.

Im capturing video frames as in http://developer.apple.com/library/ios/#qa/qa1702/_index.html.

And after acquire a 'CGImageRef' I crop the image to select the area that should contain the code. Finally delegate ZXingObjC to decode the image:

ZXLuminanceSource* source = [[ZXCGImageLuminanceSource alloc] initWithCGImage:image];
ZXBinaryBitmap* bitmap = [ZXBinaryBitmap binaryBitmapWithBinarizer:[ZXHybridBinarizer binarizerWithSource:source]];

NSError* error = nil;
ZXResult* result = [self.reader decode:bitmap hints:self.hints error:&error];

if i use 'setSampleBufferDelegate:queue' in a main queue works fine, but my animeted button on the screen looks very lagged. After create a new queue the leak appeared.

Reducing the frame rate i'm able to execute

ZXBinaryBitmap* bitmap = [ZXBinaryBitmap binaryBitmapWithBinarizer:[ZXHybridBinarizer binarizerWithSource:source]];

But the leak remains in ZXQRCodeReader's decode:hints:error: method

@andrioli
Copy link
Author

andrioli commented Feb 7, 2013

after a search on stackoverflow and on iOS doc I found that wrapping the code with @autorealesepool solves this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant