memory leaking?!
rasumner at my-deja.com
rasumner at my-deja.com
Sun Jul 18 09:34:49 EDT 1999
More information about the Python-list mailing list
Sun Jul 18 09:34:49 EDT 1999
- Previous message (by thread): memory leaking?!
- Next message (by thread): How to trace Python/sys.settrace() ?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
In article <slrn7op5jj.cva.rasumner at math5-pc.wisdom.weizmann.ac.il>, rasumner at math5-pc.wisdom.weizmann.ac.il (Reuben Sumner) wrote: > I have some code creating a somewhat complicated data structure. > When I am using Python 1.5.2 compiled with Py_REF_DEBUG I can see > that reference counts are dissapearing (although I can't figure out > what is getting lost, all the objects that I can think of I have > confirmed are being released). When I compile with Py_TRACE_REFS > then all of a sudden the reference counts don't increase between > subsequent calls. What on earth is going on here? Running "top" > and generating a lot of very large structures then memory does seem > to leak no matter which way I compile python (although I think it is > slower with Py_TRACE_REFS). Here is a really small test case demonstrating the problem. import sys class C: def __init__(self): pass print sys.getrefcount() for i in range(100): c=C() print sys.getrefcount() for i in range(100): c=C() print sys.getrefcount() for i in range(100): c=C() print sys.getrefcount() Realy simple. When I run this in an interpreter compiled with Py_REF_DEBUG but _not_ Py_TRACE_REFS there is a leakage of exactly 100 references between the 2nd and 3rd getrefcounts(). This use of sys.getrefcount() requires a small patch I posted a while ago. Alternatively run this interactively and look a the printed values for the total number of references. My Python is 1.5.2 on Linux (RedHat 6.0). Can other people reproduce this? Can anybody _not_ reproduce this? I get the same effect on IRIX6. Reuben Sent via Deja.com http://www.deja.com/ Share what you know. Learn what you don't.
- Previous message (by thread): memory leaking?!
- Next message (by thread): How to trace Python/sys.settrace() ?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list