Potential memory leak on Apple silicon (3gb fitz.Pixmap cache) #2690
Replies: 5 comments
-
The The fact that you can regain stroage at all (via shrinking store) means that memory is recoverable, there just was no reason yet to free it. I tried a few things like this one: def make_img(doc):
for page in doc:
pix=page.get_pixmap()
img= Image.frombytes("RGB", [pix.width, pix.height], pix.samples)
print(page.number, round(fitz.TOOLS.store_size/1024/1024,2)) This function I called with larger files like the Adobe manuals. Also increased pixmap DPI etc. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
@paultheman - oops, what made you close this? |
Beta Was this translation helpful? Give feedback.
-
Sorry, i thought it was not a bug being related to python memory consumption. |
Beta Was this translation helpful? Give feedback.
-
I have changed my mind: |
Beta Was this translation helpful? Give feedback.
-
Please provide all mandatory information!
Describe the bug (mandatory)
A clear and concise description of what the bug is.
I have noticed that upon calling the following function there is a memory leak that grows to about 3gb and not more.
The
fitz.Tools().store_size
does not go over 256mb, see the screenshot below.If
fitz.Tools().store_shrink(10)
is called the problem is fixed. (any argument will do...)To Reproduce (mandatory)
Explain the steps to reproduce the behavior, For example, include a minimal code snippet, example files, etc.
For problems when building or installing PyMuPDF, give the full output of the build/install command so that, for example, all pip/compiler/linker errors/warnings can be seen.
Expected behavior (optional)
Describe what you expected to happen (if not obvious).
Screenshots (optional)
If applicable, add screenshots to help explain your problem.
Your configuration (mandatory)
For example, the output of
print(sys.version, "\n", sys.platform, "\n", fitz.__doc__)
would be sufficient (for the first two bullets).3.11.3 (main, Apr 7 2023, 20:13:31) [Clang 14.0.0 (clang-1400.0.29.202)]
darwin
PyMuPDF 1.22.3: Python bindings for the MuPDF 1.22.0 library.
Version date: 2023-05-10 00:00:01.
Built for Python 3.11 on darwin (64-bit).
Additional context (optional)
Add any other context about the problem here.
Beta Was this translation helpful? Give feedback.
All reactions