[Numpy-discussion] How to check for memory leaks?
Antoine Pitrou
solipsis at pitrou.net
Tue Feb 23 14:46:47 EST 2016
On Tue, 23 Feb 2016 12:36:00 -0700
Charles R Harris <charlesr.harris at gmail.com> wrote:
> Hi All,
>
> I'm suspecting a possible memory leak in 1.11.x, what is the best way to
> check for that?
If that is due to a reference leak, you can use sys.getrefcount() or
weakref.ref().
Otherwise you may want to change Numpy to go through PyMem_RawMalloc /
PyMem_RawCalloc / PyMem_RawRealloc / PyMem_RawFree on recent Pythons,
so as to have Numpy-allocated memory accounted by the tracemalloc
module.
(https://github.com/numpy/numpy/pull/5470 may make it more
palatable ;-))
Regards
Antoine.
More information about the NumPy-Discussion
mailing list