Closed prismofeverything closed 5 years ago
Makes sense now that you've laid it out, but I wouldn't have anticipated this behavior.
Makes sense now that you've laid it out, but I wouldn't have anticipated this behavior.
Well, clearly neither did I. Very interesting though how subtle and widespread the effects of reference counting are in a garbage-collected language. So much work happening behind the scenes so you don't have to worry about cleaning up after yourself : ) Though I hope I have recently given a good demonstration of the value of having the machine manage your memory for you.
Thanks @1fish2, added a memory test and shifted the pointer.
Apparently beyond the memory leak I fixed before, there was also a reference counting error in returning values to python. As it turns out, putting the arrays into the "return tuple" required by python increments the reference count to each, which in addition to the references from instantiating them means these arrays were never released. Since this is at the python-machinery level instead of the C level I missed this before.
I did some memory profiling at the python level to ensure no more references are being missed, but things look solid after this change.