-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory Leak in Image? #74
Comments
The inline image is the example I used in my program above. |
I do not think that it is a memory leak. I bet you that if you call GC after generating the file and report memory it will be released -- though you have to be careful in Linux interpreting OS memory tool results and use Python tools instead. While the z3c.rml code is careful to not load images into memory or cache every image, it does open the file 500 times and sends it to @isparks Do you have the pure Reportlab example too? |
It's been a long while. I think this is the test program I used. The path to file is the same as used above. When I run it, memory barely moves.
|
Not saying the above is good code, clearly I don't need to be messing with aspect ratios for the same image over and over but I think I was trying to recreate conditions in the rml code. As I said, has been a while. |
Yeah, I think because I keep a file open some caching kicks in. Also, I rely on GC to close files, so not ideal either. |
You were able to see a difference? I expect that the use of XML causes some memory inflation but it seemed too much. I did a bit more digging. Here is some code I ended up with. Now instead of Most of it is copied from Image but check the line:
Might be voodoo but maybe it can help? I recall that there was no way to pass lazy=2 into the use of
|
I have a document where I add a few hundred ~300Kb images using the Image tag. These are PNG images with dimensions 1920x1080.
When I run my document the memory usage goes off the charts. The following program an example image may demonstrate. On my machine the memory usage goes to 3+GB.
A similar program using platypus and reportlab Image directly barely registers at all.
The text was updated successfully, but these errors were encountered: