-
Notifications
You must be signed in to change notification settings - Fork 17
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
Library not available: "Cannot close object, library is destroyed..." #281
Comments
See facebookresearch/nougat#162 (comment) and facebookresearch/nougat#110 (comment)
pdfium needs to be initialized before using any of its APIs, and destroyed when finished. This error means pdfium for some reason was destroyed while there were still live objects. The crash then might be due to use after free, or just memory overload or something. The odd thing is that pdfium is destroyed by an exit handler ( Anyway, as said in the other threads, nougat should just use linear rendering, then everything should work fine. |
What worsens the problem is that nougat is doing PNG saving, which is slow, so lots of transferred bitmaps produced by the pool implicitly queue up in memory over time, which can cause enormously high memory loads. FWIW I think this warning itself may not be that significant (I doubt the leaked object handles are the main issue here), it's just a symptom of a big concept mistake rooted in the deprecated API. |
@sidharthrajaram I just merged #282 via 6024f15, which replaces See also the upcoming changelog for a writeup to outline the problem. |
Hey @mara004 , thanks for the help and the great notes on the issues across this repo and on the nougat repo. Page-level linear rendering has been working fine since the initial change, but that's good to know this fix was merged. |
Package origin
pypdfium2
fromPyPI
orGitHub/pypdfium2-team
.Description
I'm using Nougat OCR, which makes use of pypdfium2. However, during calls to that function, a warning message is outputted followed by a crash. The warning message reads:
In the pypdfium2 code, this message seems to be printed when the library is not available. The possible memory leak that it is mentioning is probably what's leading to the aforementioned crash of Nougat OCR.
For that reason, under what circumstances will this message be printed? What does it mean for the library to not be available?
Install Info
Validity
The text was updated successfully, but these errors were encountered: