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

Frequent software freeze since 1.9.3 update #74

Closed
Patalliro8 opened this issue Jun 4, 2022 · 8 comments · Fixed by #76
Closed

Frequent software freeze since 1.9.3 update #74

Patalliro8 opened this issue Jun 4, 2022 · 8 comments · Fixed by #76
Labels

Comments

@Patalliro8
Copy link

Patalliro8 commented Jun 4, 2022

Since 1.9.3 update (on macOS 11.6.6), I am experiencing the software quickly slowing down until it becomes unresponsive with rotating wheel. Upon opening a 100MB file, the memory usage quickly rise from few hundred megabytes to multiple gigabytes, which may be the reason of slowdown. At this point, the only way to close the app is to force quit.

@nickv2002
Copy link
Collaborator

Thanks for the report, I'm guessing this is related to the Live Text processing. Any thoughts @DavidPhillipOster?

Maybe we need a pref to enable/disable live text?

@nickv2002 nickv2002 added the bug label Jun 4, 2022
@DavidPhillipOster
Copy link

Thanks - I'll check in to this. My test file is a copy of 'The Silver Cord' 466 pages, a 3.3 Gbyte PDF. Early in my testing I noticed I'd dropped a CFRelease of a CGImage that was responsible for bloat. I'll check your master source to see if I made a mistake in the in the pull request.

@DavidPhillipOster
Copy link

I am seeing some leaking CGImages in the current MaddTheSane/Simple-Comic . I'm working on a fix.

@DavidPhillipOster
Copy link

no, all the leaks I saw were within the PDF renderer, and still present when all of my code was never called. Not present in .cbz (My largest CBZ is also 3.4 Gbyte, 210 pages) Next pull request will focus on a pref to enable/disable live text, and I'll test on High Sierra, and on Monterey on Apple Silicon, and on Intel.

@nickv2002
Copy link
Collaborator

Thanks for your hard work @DavidPhillipOster
@Patalliro8 if you can share any more info to help debug plead do. For example, are you using Intel or Apple Silicon? Can you share the file or point us where to find it?

@Patalliro8
Copy link
Author

@nickv2002 @DavidPhillipOster
Thank you for looking into this. The issue was initially observed on Intel Mac while opening a CBZ file (zipped JPG, 230 pages, 119MB), but I can confirm this persists with PDF files (https://toyama.repo.nii.ac.jp/?action=repository_uri&item_id=935&file_id=18&file_no=1, 13 pages, 1.6MB, for example) as well.

@DavidPhillipOster
Copy link

@Patalliro8 @nickv2002
Thank you for that pdf. I didn't test with a document in Japanese, and Japanese is not a language Apple currently supports for OCR'ing with the Vision framework.

Currently, I'm planning to add an item to the preferences dialog box that will let the user control the Live Text feature ,
but, it will be on a whole - app basis, not a per-document one.

I was able to reproduce the problem, for the document in Japanese, but repeatedly using 'next page' to go all the way to the end of that document, then 'previous page' to go back to the beginning. On my M1 Mac Mini (Monterey), on this document, after 40 pages, Activity monitor shows a thread count of 70, not decreasing and the U.I. shows the beach-ball, not responding.

The English language .cbz I tried on my machine did not show this bad behavior: no beach ball, and the background threads quickly finish and free their resources.

When you navigate to a page in a book, I start up a VNRecognizer task on a background thread to recognize text on that page. For a book in English, the first time the VNRecognizer takes about 5 seconds, but after that, each following page takes less than a second.

VNRecognizer is a background task so it doesn't slow the U.I. But: if you repeatedly page through the book, it will create a new task for each page, even if you've been to that page previously. (and it holds a reference to the page data while it is working.)

When you try to quit the app, Simple Comic currently waits for all the recognizers to complete.

First easy fix: give the user a checkbox to turn Live Text support on or off, for the whole app. (maybe a popup that lists the languages it can OCR in.) I'll send a pull request for that in the next few days, and I'll add your document to my automated test suite.

My plan for future pull requests:
Later: When the user navigates away from a page, cancel any in-progress VNRecognizer tasks.
Still Later: When a VNRecognizer task completes, store the result in the in-memory page data, so if the user comes back to that page, use the cached data.
Then: register the data with Core Spotlight so it knows which page has which text.
Then: Add a Find command so once Core Spotlight says a book has some text, you can navigate to the specific page.

@nickv2002
Copy link
Collaborator

Fixed in 1.9.4
Thanks all!

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

Successfully merging a pull request may close this issue.

3 participants