-
Notifications
You must be signed in to change notification settings - Fork 641
Closed
Labels
Description
Describe the bug
insertPDF cause a memory leak
To Reproduce (mandatory)
i test the following code in a docker container:
pdf_path_list = ["input_1.pdf", "input_2.pdf", ...., "input_33.pdf"]
for i in range(1000):
out_pdf_path = "test_{}.pdf".format(i)
bt = time.time()
doc = fitz.Document()
for j in range(len(pdf_path_list)):
t0 = time.time()
sub_doc = fitz.open(pdf_path_list[j])
doc.insertPDF(sub_doc)
sub_doc.close()
print("insert pdf cost:{}".format(time.time() - bt))
bt = time.time()
# i have tested 0,1,2,3,4 and with option 4, pdf is the smallest
doc.save(out_pdf_path, garbage=4)
doc.close()
print("save to pdf cost:{}".format(time.time() - bt))
when i tested ,the docker container memory usage increase from 96MB to 300MB, and then 400MB.
is there a memoy leak?
Your configuration (mandatory)
sys version and platform are as follows:
3.7.4 (default, Aug 14 2019, 12:19:22)
[GCC 8.3.0]
linux
PyMuPDF 1.17.6: Python bindings for the MuPDF 1.17.0 library.
Version date: 2020-08-26 14:54:32.
Built for Python 3.7 on linux (64-bit).