Skip to content
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 #2

Open
quet opened this issue Jul 4, 2012 · 2 comments
Open

memory leak #2

quet opened this issue Jul 4, 2012 · 2 comments

Comments

@quet
Copy link

quet commented Jul 4, 2012

Hi! I'm having a memory leak when liveview is running, is there any way to avoid this?

Regards

code:

def liveview():
global main_surface
C = piggyphoto.camera()
C.leave_locked()
C.capture_preview('./Ims/preview.jpg')
picture = pygame.image.load("./Ims/preview.jpg")
pygame.display.set_mode(picture.get_size())
main_surface = pygame.display.get_surface()
pygame.display.set_caption("Vista en Vivo")
while not quit_pressed():
C.capture_preview('./Ims/preview.jpg')
show("./Ims/preview.jpg")
pygame.display.quit()
C.exit()
os.remove("./Ims/preview.jpg")

@holger-hoffmann
Copy link

Hi.

Had the same problem. Within two minutes the preview.py went up to 60% memory consumption (from 1.6% at the start).

Apparently the problem is that in the capture_preview function cfile = cameraFile() does not get destroyed. So I deallocated it manually.

cfile.save(destpath)
cfile.__dealoc__(destpath)  # destroy cfile memory

Please bare with me, I do almost never program in python, so maybe I did something completely stupid trying to solve this. But at least it works for me (preview.py running for 2 hours, no memory leaking).

Hope this helps.

@kaist
Copy link

kaist commented Apr 11, 2015

s=self.cam.capture_preview()
s.save('/tmp/preview.jpg')
s.clean()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants