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

David Baddeley david_baddeley@yahoo.com...
Wed Nov 3 20:44:22 CDT 2010


If you want python to garbage collect it, the reference count should only be 1 
when you return it to python - are you 'incref'ing it somewhere in your c code? 
It will get garbage collected when the ref count drops to zero, and deleting it 
just drops it by one.

David


----- Original Message ----
From: Stuart Wilkins <swilkins@bnl.gov>
To: scipy-user@scipy.org
Sent: Thu, 4 November, 2010 1:30:09 PM
Subject: [SciPy-User] Memory Leak? Problems with deleting numpy arrays.

Hi,

I am having some difficulty with memory management with numpy arrays. I have 
some c-code which creates a numpy array which is fairly large (2 Gb), this is 
passed back to python. Checking the reference count, it is 2 at this point. 
After performing a further operation, the reference count is still 2 and then I 
delete it. 


The problem is that the memory never gets released. It does not take too many 
passes for this  to basically fail as the system runs out of memory.

So? Does anyone have any ideas? I can send code later. What should the ref count 
be before del to ensure that the object is garbage collected? 


I find calling gc.collect() does not solve the problem.

Any ideas?
S
_______________________________________________
SciPy-User mailing list
SciPy-User@scipy.org
http://mail.scipy.org/mailman/listinfo/scipy-user



      


More information about the SciPy-User mailing list