Comments (5)
I was able to confirm this using the Instruments tool in Xcode. The following "pix_malloc" function seems to allocate 32KB every time "setImage" is called on the Tesseract object:
from tesseract-ocr-ios.
It's late so I might be wrong about this, but it looks like the imageThresholder->GetPixRect()
call at https://github.com/gali8/Tesseract-OCR-iOS/blob/master/TesseractOCR%2FTesseract.mm#L218 should destroy the Pix
result once it's done with it, according to the documentation here: http://fossies.org/dox/tesseract-ocr-3.02.02/classtesseract_1_1ImageThresholder.html#a0b855cc35144b84f150bf39d5342d7f1
In the next day or so I'll try saving a reference to the result of GetPixRect()
(possibly in the existing, seemingly unused _pixels
member field) and calling the Leptonica function pixDestroy()
(https://tpgit.github.io/Leptonica/pix1_8c.html#a11c3800e3ec598556b1f4779a2079bbd) on any pixels that should be thrown away (e.g. between successive calls to setImage()
). Or feel free to take a crack at it if you feel up to it.
from tesseract-ocr-ios.
I believe I've fixed the memory leak. I've added these commits to my existing pull request, but I don't know how active this repo's maintainers are, so in the meantime you can use my fork here: https://github.com/kevincon/Tesseract-OCR-iOS
If you're using CocoaPods, you can add this line to your Podfile to switch to using my fork:
pod 'TesseractOCRiOS', :git => 'https://github.com/kevincon/Tesseract-OCR-iOS.git', :branch => 'master'
from tesseract-ocr-ios.
Thanks Kevin!
All merged.
from tesseract-ocr-ios.
Thanks kevincon! This is tremendously helpful.
from tesseract-ocr-ios.
Related Issues (20)
- .
- User-Words file not loaded: Error: failed to load user-words HOT 5
- doesn't work with 64bpp images
- pod failed HOT 1
- Does not detects images 100%
- What's means with *.cube.* ? e.g. eng.cube.fold
- Why does the testsdata folder exist in the project? HOT 2
- Why don't we upgrade to the latest Tesseract?
- cocoapods 5.0.1 error
- Xcode 12.0.1 build is failing when trying to run it on the simulator. HOT 2
- RecognitionQuestion
- Apple Silicon (arm64; M1) support HOT 2
- Thread 1: EXC_BAD_ACCESS (code=1, address=0x163940000)
- Framework not found for Mac OS HOT 1
- 你好 这句一定闪退
- PDF creation not working
- self.tesseract!.recognize() is crashing in Acuant MRZ
- How to update Tesseract version
- Target 'TesseractOCRiOS' (project 'Pods') has copy command HOT 1
- cannot load language 'eng' HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tesseract-ocr-ios.