Unfortunately I haven't had any luck with this either. Right now I'm trying damage control by just trying to minimize the leakage by not performing as many tesseract recognition call, but the downside of that is that I get much worse quality out of my app.
Any further suggestions on how to approach the memory leak is very welcome! Thanks, Fredrik Dyrkell Den onsdagen den 17:e oktober 2012 kl. 19:30:56 UTC+5:30 skrev zdenop: > > What about if you just do init() and Eng()? > > -- > Zdenko > > On Wed, Oct 17, 2012 at 1:37 PM, Stane <[email protected] <javascript:> > > wrote: > >> Same here, >> the whole process of >> init(), recognize(), End() leafs a big memory leak. >> Already submitted the issue some month ago. >> >> https://code.google.com/p/tesseract-ocr/issues/detail?id=713 >> >> >> On Wednesday, October 17, 2012 10:39:22 AM UTC+2, Fredrik Dyrkell wrote: >>> >>> Thanks for your suggestion, >>> >>> I have tried various combinations of clear and end, such as >>> >>> 1. Running both Clear() and End() after each scan (and also having to >>> re-initialize with Init() each time). >>> 2. Running Clear() every time, and End()/Init() only once every 50 scan >>> or so. >>> >>> The End()/Init() actually releases some of the memory, but it's still >>> leaking at a fast speed. >>> >>> Regards, >>> Fredrik >>> >>> >>> Den onsdagen den 17:e oktober 2012 kl. 10:31:41 UTC+2 skrev zdenop: >>>> >>>> Try to call tess->Clear() or tess->**End(). See comment for them in >>>> source[1]. >>>> >>>> [1] http://code.google.com/p/**tesseract-ocr/source/browse/** >>>> trunk/api/baseapi.h#570<http://code.google.com/p/tesseract-ocr/source/browse/trunk/api/baseapi.h#570> >>>> >>>> -- >>>> Zdenko >>>> >>>> On Wed, Oct 17, 2012 at 9:55 AM, Fredrik Dyrkell >>>> <[email protected]>wrote: >>>> >>>>> Hi all, >>>>> >>>>> I'm developing an application that's using tesseract on the iPhone. >>>>> Unfortunately I'm having a hard time tracking down a memory leak problem >>>>> that seems to be inside of the tesseract library. >>>>> >>>>> Here is the code I'm using: >>>>> >>>>> CGSize imageSize = [uiImage size]; >>>>> int bytes_per_line = (int)CGImageGetBytesPerRow([**uiImage CGImage]); >>>>> int bytes_per_pixel = (int)CGImageGetBitsPerPixel([**uiImage >>>>> CGImage]) / 8.0; >>>>> >>>>> if(imageSize.width > 0 && imageSize.height > 0) { >>>>> CFDataRef data = CGDataProviderCopyData(**CGImageGetDataProvider([ >>>>> **uiImage CGImage])); >>>>> const unsigned char* imageData = CFDataGetBytePtr(data); >>>>> tess->SetImage(imageData, >>>>> imageSize.width, imageSize.height, >>>>> (int)bytes_per_pixel, (int)bytes_per_line); >>>>> char* text = tess->GetUTF8Text(); >>>>> NSString* string = [NSString stringWithCString: text >>>>> encoding:NSUTF8StringEncoding]**; >>>>> NSLog(@"%@", string); >>>>> delete[] text; >>>>> } >>>>> >>>>> 1. I'm freeing the text string returned from tesseract. From the >>>>> profiling I've done, I'm leaking memory at a high speed from within the >>>>> Recognize method. Is the image data for some reason retained? >>>>> >>>>> 2. I have tried to use the 3.02 from the svn trunk, but ran into other >>>>> problems on my OSX machine: >>>>> >>>>> index >= 0 && index < size_used_:Error:Assert failed:in file >>>>> ../ccutil/genericvector.h, line 512 >>>>> >>>>> Any thoughts on what to try next? Anything obvious that I'm missing in >>>>> the code? >>>>> I'm starting to run out of ideas. >>>>> >>>>> Thanks in advance >>>>> Fredrik Dyrkell >>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "tesseract-ocr" group. >>>>> To post to this group, send email to [email protected] >>>>> To unsubscribe from this group, send email to >>>>> tesseract-oc...@googlegroups.**com >>>>> For more options, visit this group at >>>>> http://groups.google.com/**group/tesseract-ocr?hl=en<http://groups.google.com/group/tesseract-ocr?hl=en> >>>>> >>>> >>>> >>>> -- >> You received this message because you are subscribed to the Google >> Groups "tesseract-ocr" group. >> To post to this group, send email to [email protected]<javascript:> >> To unsubscribe from this group, send email to >> [email protected] <javascript:> >> For more options, visit this group at >> http://groups.google.com/group/tesseract-ocr?hl=en >> > > -- You received this message because you are subscribed to the Google Groups "tesseract-ocr" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/tesseract-ocr?hl=en

