any problem with py's RC?
Marc 'BlackJack' Rintsch
bj_666 at gmx.net
Fri Aug 24 09:11:56 EDT 2007
On Fri, 24 Aug 2007 19:44:37 +0800, Yan Zhu wrote:
> Here is 3 PYs, we found there is a big memory wasting, specially the program
> c.py, we found the memory will increase very soon.
> any body knows why? any RC's problem? thanks
You are creating reference cycles and instantiate many in very short time.
Objects with cyclic dependencies must be detected by the garbage collector
which takes some time.
Usually this is not a problem because generating lots of cycles in a tight
and endless ``while``-loop is not *that* common. ;-)
You may take a look into the `weakref` module to avoid the cycles.
Ciao,
Marc 'BlackJack' Rintsch
More information about the Python-list
mailing list