alhappler/alh_pdf_view

Crashing when viewing PDFs with a lot of pages

Opened this issue · 10 comments

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?

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

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.

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

@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.

@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.

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

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.

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

Can you link the issue you posted there?

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