jbaiter / gphoto2-cffi

Python bindings for libgphoto2 with an idiomatic API
GNU Lesser General Public License v3.0
38 stars 17 forks source link

Attempt to fix memory leak when creating CameraFile #9

Closed gdunstone closed 8 years ago

gdunstone commented 8 years ago

I noticed that I couldnt capture more than 10 pictures with a raspberry pi. It leaks memory. I think I fixed most of it up but I'm not 100% sure. I also switched from returning a buffer to copying the contents to bytes and returning that, because otherwise I couldnt free the CameraFile.

jbaiter commented 8 years ago

Thank you! I think it was doing a copy before as well, so this is definitely an improvement :-) I think the only way around this would be to make the File class more file-like with a close method that frees the memory.

gdunstone commented 8 years ago

I'll look into making it a context manager today. It still leaks about ~200kb per large fine jpeg from a d70, but it's not as urgent for me (I just set up a systemd service with restart=always).

On 18 Aug 2016, at 03:04, Johannes Baiter notifications@github.com wrote:

Thank you! I think it was doing a copy before as well, so this is definitely an improvement :-) I think the only way around this would be to make the File class more file-like with a close method that frees the memory.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.