izuzak / atom-pdf-view

Support for viewing PDF files in Atom.
https://atom.io/packages/pdf-view
MIT License
106 stars 30 forks source link

Out of memory problem #72

Closed jadnohra closed 8 years ago

jadnohra commented 9 years ago

I struggled for months to track my out of memory issue to using the pdf-view plugin. My usage is such that I write latex in atom.io, generate the pdf and let pdf-view reload the pdf. What happens is that after some iterations, I run out of memory in the atom-helper process (on mac). This does not seem to happen when I am not using pdf-view. I do not know if this is an pdf-view, pdf.js or chromium problem, but it would be great to find the source of the problem.

by the way, great plugin!

izuzak commented 8 years ago

Sorry for the delay in getting back to you on this, @jadnohra.

I'm on a Mac as well so I'm hoping I can reproduce this. Can you share what you workflow is like and which error you're getting exactly?

You said you see that an atom-helper process is running out of memory -- may I ask how you know that's happening? Also, does this happen with every latext file, or only some (e.g. large ones)? Can you share a latext document you've been able to reproduce this with and steps to reproduce? How many iterations of refreshing does it normally take for this to happen (e.g. ~10 or ~100)? Which version of Atom are you using exactly, which version of pdf-view, and which version of OSX do you have?

jadnohra commented 8 years ago

@izuzak I will try to reproduce as soon as I can.

jadnohra commented 8 years ago

My workflow is too complicated to create a reproduction at the moment. Nevertheless, I think that if you take any pdf (even a small one) and constantly reload it (actual reload despite it not changing) you might seem the memory go up in atom helper.

izuzak commented 8 years ago

Which version of Atom are you using exactly, which version of pdf-view, and which version of OSX do you have? Does this happen only if you generate PDFs with the latex package or does it happen even if you just open a random PDF from the disk and reload it many times?

jadnohra commented 8 years ago

OS X Yosemite, the latest of atom and pdf-view. I always stay up to date with the latest, but this has had no consequence on the problem. I use pdf-view to read PDFs that I am writing myself, which are in the order of 20 pages at most. I write my pdfs using pandoc and/or latex. I have not tested it with larger pdfs from others since these I do no edit, and hence read using other apps which are better for reading. I hope this helps.

izuzak commented 8 years ago

@jadnohra So, how exactly would I reproduce the problem using pdf-view only? I start Atom, I open a PDF in Atom using pdf-view, and what do I do then? You said that you repeatedly reload the file, but I'm not sure I understand how you do that in Atom.

Can you share exactly what I should do to observe the problem of increasing memory (in detailed steps), assuming that I have only these two things: a PDF file and Atom with pdf-view installed?

jadnohra commented 8 years ago

I had some time today to create a (negative) repro. It uses the following tex file:

\documentclass{article} \usepackage{lipsum} \begin{document} \lipsum[1-100] \end{document}

First I turned it into a pdf (pdflatex repro.tex) and created a python script that touched it periodically while it was open in atom.io, but atom would not reload it (I do not know how the reload mechanism works). Instead, I rewrote the python script to recreate the pdf every time. Here is the python script

usage example: python repro.py repro.tex 50 2

import sys,subprocess,time,shutil file = sys.argv[1]; count = int(sys.argv[2]); interv = int(sys.argv[3]); for i in range(count): print '{}/{}{}'.format(i+1, count, '\n' if i%24==0 else ''), sys.stdout.flush() pop = subprocess.Popen(["pdflatex", 'repro.tex'], stdout=subprocess.PIPE) pop.wait() time.sleep(interv)

While I ran the script I observed visible reloading in atom.io. The memory of atom helper went up and down, but it did not increase in general. Hence, I conclude that the out of memory problem is not due to pdf-view, but due to atom.io, it could probably be related to this: https://github.com/atom/atom/issues/1827

Thanks for your willingness to help.

BDMorrell commented 8 years ago

I've had this problem, too, and accidentally made a duplicate issue. I'm still trying to find a good way to reproduce this, though so far I only have the recommendation to just work on a LaTeX document and reload again and again and again. :confused:

jadnohra commented 8 years ago

At least it's not only me...

lukaspestalozzi commented 7 years ago

I have a similar issue: Opening a "large" pdf (3.2MB) increased the memory usage of atom. But closing the tab with the pdf does not release the memory. And opening the pdf again increases the memory even more. Only closing atom releases all memory.

You can see the memory usage in the picture below. The first small bump from left (55 seconds) appeared when starting atom, the big bump (before 40 seconds) when opening the pdf. Closing the pdf had no effect, but opening it again gave the second big bump (25 seconds). The massive drop at 10 seconds appeared after closing atom.

screenshot from 2017-02-25 22-33-33