[Numpy-discussion] bool_ leaks memory

Albert Strasheim fullung at gmail.com
Sat Apr 15 04:59:03 CDT 2006


Hello all

According to Valgrind 3.1.1, the following code leaks memory:

from numpy import bool_
bool_(1)

Valgrind says:

==32531== 82 (80 direct, 2 indirect) bytes in 2 blocks are definitely lost
in loss record 7 of 25
==32531==    at 0x400444E: malloc (vg_replace_malloc.c:149)
==32531==    by 0x45442E8: array_alloc (arrayobject.c:5330)
==32531==    by 0x454F18D: PyArray_NewFromDescr (arrayobject.c:4153)
==32531==    by 0x4551844: Array_FromScalar (arrayobject.c:5768)
==32531==    by 0x45602B7: PyArray_FromAny (arrayobject.c:6630)
==32531==    by 0x4570065: bool_arrtype_new (scalartypes.inc:2855)
==32531==    by 0x2FBF6E: (within /usr/lib/libpython2.4.so.1.0)
==32531==    by 0x2C53B3: PyObject_Call (in /usr/lib/libpython2.4.so.1.0)

The second leak that Valgrind reports is from this code in ma.py:

MaskType = bool_
nomask = MaskType(0)

Tested with NumPy 0.9.7.2358.

Trac ticket at

http://projects.scipy.org/scipy/numpy/ticket/60

Regards,

Albert





More information about the Numpy-discussion mailing list