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

Crashing when viewing PDFs with a lot of pages #47

Open
carman247 opened this issue Apr 3, 2024 · 10 comments
Open

Crashing when viewing PDFs with a lot of pages #47

carman247 opened this issue Apr 3, 2024 · 10 comments
Labels
bug Something isn't working

Comments

@carman247
Copy link

I've recently found that when trying to browse though PDFs with a lot of high quality pages, in my experience with newspaper PDFs, it will get to a certain poin, around page 60-70 out of 200, and then eventually freeze before crashing the app.

I'm unable to view any kind of crash log but I'm wondering if it's something to do with the device running out of memory.

It seems like pages are cached and load quicker when viewing a previous one. Do they get disposed after a certain point, like 10 pages behind?

@andreBalh andreBalh added the bug Something isn't working label Apr 4, 2024
@andreBalh
Copy link
Collaborator

Hello @carman247

I am not sure if they are getting disposed. I am using a native library (AndroidPdfViewer) for the widget. I can check if there are known issues or settings to improve this behavior

@andreBalh
Copy link
Collaborator

I found something which could prevent the memory leaks for large pdf files.

DImuthuUpe/AndroidPdfViewer#495 (comment)

I will write a ticket in my company and hopefully we will focus on that issue which depends on the priority. If you feel motivated, you could try this also and open a pull request, then I can review it.

@andreBalh
Copy link
Collaborator

And can you give me further information about the device that had this issue? And is it possible to upload the PDF which caused this issue? @carman247

@carman247
Copy link
Author

carman247 commented Apr 8, 2024

@andreBalh thanks for the reply. I've taken a look at the Memory Leak issue but currently not having much luck trying to implement it currently. If I get it to work I'll let you know and will try to find a PDF that is causing it to crash so you can test it.

The device is a Samsung Tab A8.

@carman247
Copy link
Author

@andreBalh

Hi, I'm still having issues. The only problem I seem to have currently is that when trying to open a PDF after performing the recommended changes is that it cannot seem to find the required native methods. I've tried running ndk-build in the jni directory, like suggest by one user in the thread but I'm still having no luck.

I'm wondering if it's something to do with jitpack not compiling those files or something. I really don't know enough about that kind of thing.

Do you have any idea what could be going wrong? I've also tried just including both Pdfium locally in AndroidPdfViewer and then AndroidPdfViewer locally inside of this package.

Any help would be greatly appreciated.

@andreBalh
Copy link
Collaborator

That's hard to say, I have to try it on my own. What you can check (I don't think that fixed your issue) but you could try to update this package to version 2.0.0. I updated the whole package also native dependencies, maybe that helps a bit @carman247

@carman247
Copy link
Author

I tried with the latest version but the version being implemented of AndroidPdfViewer still has the issue with a memory leak.

I've hit a brick wall trying to get my forked versions to compile while maintaining the required .so files. It seems like all but one are being included/compiled when AndroidPdfViewer is being built on Jitpack. Also when attempting to build locally. So, I'm really not sure what to do.

I have sent a message to the owner of the forked repo that you're using and hoping that he will respond soon.

@andreBalh
Copy link
Collaborator

I see, thanks for doing so much, let's hope the owner can help there @carman247

@andreBalh
Copy link
Collaborator

Can you link the issue you posted there?

@carman247
Copy link
Author

I'm unable to post an issue on Mhiew's forked repo but I've sent them an email.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants