Memory leak moving from 9.0.0 to 9.1.0 #6434
-
I maintain reportlab most likely badly. A user reported a memory leak problem running a large chart generation job with reportlab. I observed the problem on windows amd64 and linux x86_64. Only the pillow package was changed. reportlab uses Pillow to convert bitmaps to standard formats. In this case we are just saving png. I'm not sure I can replicate the error in a fully open source manner, but would certainly like to try and find the source of the problem. I will try to create a simpler test example. Is anything known about memory leaks in pillow; what tools should I be trying to use? In linux htop provides updated memory usage as the script runs on windows the process inspector shows a steep graph for memory usage. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
The gold standard for memory leaks is valgrind, but that generally requires a reproducible test case so that it can be run with instrumentation. Do you have an idea of the pillow operations that are being called, and approximately how many times? |
Beta Was this translation helpful? Give feedback.
-
I think we are just saving the image with reportlab's renderPM.py; the internal graphics state is just an RGB buffer drawn to by bits of libart_lgpl. The code looks like def toPIL(self):
im = _getImage().new('RGB', size=(self._gs.width, self._gs.height))
(getattr(im,'frombytes',None) or getattr(im,'fromstring'))(self._gs.pixBuf)
return im
def saveToFile(self,fn,fmt=None):
im = self.toPIL()
.........
im.save(fn,fmt,**configPIL) I will have to check what the example stuff is actually doing to set up the configPIL keyword arguments and if the filename is a simple string. The test script is writing out 1134 images. I'll do some simpler testing tomorrow; after a dentist visit :( |
Beta Was this translation helpful? Give feedback.
The gold standard for memory leaks is valgrind, but that generally requires a reproducible test case so that it can be run with instrumentation. Do you have an idea of the pillow operations that are being called, and approximately how many times?