[SciPy-User] Memory Leak? Problems with deleting numpy arrays.

Christopher Barker Chris.Barker at noaa.gov
Mon Nov 8 12:15:36 EST 2010


On 11/6/10 1:06 PM, Stuart Wilkins wrote:
> Thanks for the info, it appears that all refcounts are 2, as told from getrefcount() which means it is really one (from what you say)
>
> In that case, I am really confused, if i "del" the array or even "del" the whole class in which the arrays are defined. the memory still leaks. Is it possible that these numpy arrays are not being freed by the gc, or that the memory is not being "freed" when the numpy array is deleted?

I suspect that it's not a problem with the python object sticking 
around, but with the underlying memory. Are you quite sure you're not 
mallocing something you're not freeing?

Sorry, I've deleted your original post, but are you passing in a data 
pointer to PyArray_NewFromDescr() or PyArray_New() ? if so, then you to 
free that memory in your own code.

Anyway, perhaps you could post your array creation code again, and 
someone will see something (or just use cython!)

-Chris



-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov



More information about the SciPy-User mailing list