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

Nathaniel Smith njs@pobox....
Fri Nov 5 11:58:51 CDT 2010

On Wed, Nov 3, 2010 at 5:30 PM, Stuart Wilkins <swilkins@bnl.gov> wrote:
> 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.

You also might want to try calling gc.get_referrers(arr) before
deleting it, to check if you have any stray references to the array
still around. (gc.get_referrers isn't guaranteed to detect every
reference, I think, but it will detect many.)

-- Nathaniel

More information about the SciPy-User mailing list