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? #1

Open
etarts opened this issue Oct 17, 2016 · 5 comments
Open

Memory leak? #1

etarts opened this issue Oct 17, 2016 · 5 comments

Comments

@etarts
Copy link

etarts commented Oct 17, 2016

I modified the code slightly to just go through a bunch of images and repeat. This is for a museum installation and must run continuously. It seems that the imagebuf doesn't get freed so eventually I run out of memory. I don't know enough about how Python manages memory to fix this. Can you confirm this leak exists and find a fix? Just run "top" along side it and watch the memory usage as you load new images.

Thanks for the great software!
Ed

@PaintYourDragon
Copy link
Contributor

Does it in fact crash after a while, or does memory use just get really big but it keeps running?
If the latter, most likely a case of the Python garbage collector not running until actually needed.

@etarts
Copy link
Author

etarts commented Oct 19, 2016

It does crash. That's why I noticed it.

On Oct 18, 2016 3:50 PM, "Paint Your Dragon" notifications@github.com
wrote:

Does it in fact crash after a while, or does memory use just get really
big but it keeps running?
If the latter, most likely a case of the Python garbage collector not
running until actually needed.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#1 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFGd_Wn5J_rbgNs7XfytDkB7h-aBbxbVks5q1U1PgaJpZM4KZJwK
.

@etarts
Copy link
Author

etarts commented Oct 19, 2016

There seems to be an issue also with the RGB order. Setting it does affect
the colors when explicitly setting colors like in the loading / proccessing
sequence, but not the order of the processed image. I had to alter the C
code in lightpaint.c to swap the red and green for my newer RGB stick to
get the color order right.

Ed Tannenbaum
Electrons Tamed for the Arts
PO Box 398
Crockett, CA 94525
www.et-arts.com
+1 510 787-1567

On Tue, Oct 18, 2016 at 6:08 PM, Ed Tannenbaum et@et-arts.com wrote:

It does crash. That's why I noticed it.

On Oct 18, 2016 3:50 PM, "Paint Your Dragon" notifications@github.com
wrote:

Does it in fact crash after a while, or does memory use just get really
big but it keeps running?
If the latter, most likely a case of the Python garbage collector not
running until actually needed.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#1 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFGd_Wn5J_rbgNs7XfytDkB7h-aBbxbVks5q1U1PgaJpZM4KZJwK
.

@PaintYourDragon
Copy link
Contributor

Python modules are new territory for me, so I might be handling references wrong WRT allocation and deallocation. Looking at some others' code, here's something that might be worth trying...in lightpaint.c, toward the end of the LightPaint_new() function, comment out this line:
Py_INCREF(self); // Done, save object
Mmmmight need to add a Py_DECREF(self) first thing in the else case that immediately follows.
Basically, I'm wondering if the first reference is implicit, and the INCREF may be doubling up and thus never allowing the object to be freed. Worth trying!

@etarts
Copy link
Author

etarts commented Oct 20, 2016

That seems to have plugged it! I just commented out the Py_INCREF(self).
No DECREF necessary. Excellent! Thanks!

The RGB order bug still stands but for me is solved. I can't tell where
that happens. Either the parsing and treating of the order argument in
lightpaint, starting at line 74, or the double use of the order cancelling
itself out? It works in setPixelColor() in DotStar.

Ed Tannenbaum
Electrons Tamed for the Arts
PO Box 398
Crockett, CA 94525
www.et-arts.com
+1 510 787-1567

On Wed, Oct 19, 2016 at 2:43 PM, Paint Your Dragon <notifications@github.com

wrote:

Python modules are new territory for me, so I might be handling references
wrong WRT allocation and deallocation. Looking at some others' code, here's
something that might be worth trying...in lightpaint.c, toward the end of
the LightPaint_new() function, comment out this line:
Py_INCREF(self); // Done, save object
Mmmmight need to add a Py_DECREF(self) first thing in the else case that
immediately follows.
Basically, I'm wondering if the first reference is implicit, and the
INCREF may be doubling up and thus never allowing the object to be freed.
Worth trying!


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#1 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFGd_QevY50EedB2EnI-OOJRAZlD4PQzks5q1o8CgaJpZM4KZJwK
.

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

2 participants