On Oct 23, 2008, at 7:57 AM, Simon King wrote: > 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 --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---
