convertToPDF() has memory leak (original) (raw)

Please provide all mandatory information!

for img in os.listdir("C:\pil"):
imgdoc=fitz.open(os.path.join("C:\pil",img))
imgdoc.convertToPDF()
imgdoc.close()

I executed the above line of code my RAM bumped up to 2gb to 3 gb and did not come down at all

Describe the bug (mandatory)

A clear and concise description of what the bug is.
Memory leak in convertToPDF()

To Reproduce (mandatory)

Explain the steps to reproduce the behavior, For example, include a minimal code snippet, example files, etc.

execute the following lines of code with images in any folder:

I executed with 420 images -> 1 GB ram occupied

for img in os.listdir("C:\pil"):
imgdoc=fitz.open(os.path.join("C:\pil",img))
imgdoc.convertToPDF()
imgdoc.close()

Expected behavior (optional)

Describe what you expected to happen (if not obvious).

Memory usage should come down

Screenshots (optional)

If applicable, add screenshots to help explain your problem.

Your configuration (mandatory)

Windows 10 4 gb RAM

For example, the output of print(sys.version, "\n", sys.platform, "\n", fitz.__doc__) would be sufficient (for the first two bullets).

Additional context (optional)

Add any other context about the problem here.