• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Memory Leak in Embed API?

Community Beginner ,
Aug 11, 2021 Aug 11, 2021

Copy link to clipboard

Copied

I'm building an application using the Embed API.  The client is using this application to view and annotate large PDFs (in the range of 25-60MB).  It seems that as he scrolls through the document, the further he gets through it the worse the application runs.  I've done some initial profiling in Chrome and it looks like the memory consumption of the Embed part of the application just continues to grow as you scroll through the document.  I didn't dig into it too much, but at first pass it looked like it had something todo with mobx.  

 

It seems as though there might not be any virtualization in the Embed API so as pages are created (and potentially made observable (if mobx)) nothing is removing listeners / subscriptions.  

 

Anyways, it's unfortunately a bit of a deal breaker for my client so I told them that I would investigate.

TOPICS
PDF Embed API

Views

377

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 01, 2021 Sep 01, 2021

Copy link to clipboard

Copied

Would it be useful for me to post a video of the memory audit I did?  It just seems that the PDF viewer doesn't have any virtualization for it's pages, so everytime a page is rendered it continues to consume the resources.  I suspect there may be some event handlers internally that aren't being released.

 

Anyways, my client is typically working with quite large PDF's and after scrolling through a majority of the pages the viewer becomes less and less responsive until he must reload the entire application.  Would be great to get some feedback on this.  I'm happy to put together whatever info is necessary.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 01, 2021 Sep 01, 2021

Copy link to clipboard

Copied

This seems normal and natural. This is not a memory leak but simple memory use. It would be a leak if, after viewing all pages, and going back to view ones you've already seen, the memory kept going up.

PDF is a compressed format, and to read it, the information in it has to be decompressed, which can cause it to grow a lot. This is done on demand, so as you progress through the document more will be decompressed.  Adobe's programmers had the choice of throwing away each decompressed page after showing it, or cacheing it. My guess is that Adobe's programmers took the "infinite memory" model and cached everything.

Note: I am not saying this is the right choice in all situations, but I am saying your label "memory leak" is absolutely wrong. Using the wrong technical term for problems is a sure way to get nowhere with them.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 01, 2021 Sep 01, 2021

Copy link to clipboard

Copied

@Test Screen Name Good feedback, thanks for responding. 

I'll update the post title to be more reflective of the end user experience.  Yea, I'd have to go back and do a more thorough analysis of the memory dumps / behavior to confirm that it was indeed a leak and not just memory consumption.  But you're right, in this case I haven't definitevely determined that there is a leak more just that the user experience degrades significantly after long durations of using the Embed Api.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 01, 2021 Sep 01, 2021

Copy link to clipboard

Copied

LATEST

I can't seem to find a way to update the Topic of this discussion.. so I guess I'll just leave it as is.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources