Valgrind is the thing to try: http://wiki.sagemath.org/ValgrindingSage
--
Carlo Hamalainen
http://carlo-hamalainen.net
I think so but I'm not 100% sure, this seems to be new in 3.1.2 and I
last used Valgrind on an earlier version of Sage.
> Dear Sage team,
>
> I have two cdef'd classes (lets call them A and B). They have some
> cdef'd attributes that should be harmless, namely of type int or list
> or dict. The entries of these lists/dicts may be objects of class A
> though.
>
> Let me emphasize that A and B do not rely on any external (wrapped) C-
> Types. They are entirely built from int, list, dict, object. In
> particular, I am not doing any nasty memory allocation.
>
> I understood that Cython knows how to allocate and deallocate cdef'd
> attributes of type int, list, dict, object etc. Hence, I expected that
> I do not need to provide __del__ or __dealloc__ methods for A and B.
> And I expected that it is virtually impossible to produce a memory
> leak in such setting.
Well, memory leaks are always possible, but this should be safe (i.e.
if there's a bug, it's in Cython). Can you post what your class
definition is?
>
> Nevertheless, get_memory_usage() shows that
> creating an object of class B,
> doing a computation "Result = B(...)", and
> deleting B
> results in an increased memory usage of 2.57MB per run.
>
> What tools do you recommend to tracking that memory leak down?
Are you running this from the command line? IPython does lots of
caching of results--try doing the whole operation in a function body
and see if the results are the same.
- Robert