[Numpy-discussion] Tracking and inspecting numpy objects

Mads Ipsen mads.ipsen at gmail.com
Mon Sep 15 04:16:26 EDT 2014


Hi,

I am trying to inspect the reference count of numpy arrays generated by 
my application.

Initially, I thought I could inspect the tracked objects using 
gc.get_objects(), but, with respect to numpy objects, the returned 
container is empty. For example:

import numpy
import gc

data = numpy.ones(1024).reshape((32,32))

objs = [o for o in gc.get_objects() if isinstance(o, numpy.ndarray)]

print objs                # Prints empty list
print gc.is_tracked(data) # Print False

Why is this? Also, is there some other technique I can use to inspect
all numpy generated objects?

Thanks in advance.

Best regards,

Mads

-- 
+---------------------------------------------------------+
| Mads Ipsen                                              |
+----------------------+----------------------------------+
| Gåsebæksvej 7, 4. tv | phone:              +45-29716388 |
| DK-2500 Valby        | email:      mads.ipsen at gmail.com |
| Denmark              | map  :   www.tinyurl.com/ns52fpa |
+----------------------+----------------------------------+



More information about the NumPy-Discussion mailing list