Closed SylvainBert closed 6 years ago
Just out of curiosity, does it work if you call gc.collect()
just before tool.image_to_string()
?
Note also that the problem may not be where you think it is: There may be a memory leak somewhere else. While tool.image_to_string()
may use a lot of memory (and therefore be where the code usually crashes), the memory leak can be anywhere else.
I guess an easy way to check that would be to:
1) add a call to gc.collect()
in the loop.
2) comment the call to tool.image_to_string()
(and replace it by something like txt = ""
)
3) run your script and watch with top or gnome-system-monitor if the memory usage of your script keep going up or is stable.
Thanks for your help! I think you're right when i do what you say i can see increase of memory with top command.
Do you have any idea to find where is the memory leak?
That's okay !
I change image_jpeg = image_pdf.convert('jpeg') to deal with a with
statement and my memory is stable.
Thank you, in fact i just lost my time to search problem where they are not !
Hi, I wanna use a loop with python to transfrom several pdf in text but after 100 files i have this error :
the code is :
Have a nice day!