On Mon, Mar 24, 2003 at 01:40:44PM +0100, Christian Tismer wrote: > > I just tested generators and found a memory leak. > (Has nothing to do with generators). > The following code adds one to the overall refcount > and gc cannot reclaim it. > > def conjoin(gs): > def gen(): > gs # unbreakable cycle > gen # unless one is commented out With current CVS: >>> gc.collect() 0 [23150 refs] >>> conjoin(1) [23160 refs] >>> conjoin(1) [23170 refs] >>> gc.collect() 8 [23151 refs] >>> conjoin(1) [23161 refs] >>> conjoin(1) [23171 refs] >>> gc.collect() 8 [23151 refs] >>> conjoin(1) [23161 refs] >>> conjoin(1) [23171 refs] >>> gc.collect() 8 [23151 refs] One ref may be leaked the first time gc.collect() is called with garbage (23150 -> 23151). But after that, no more refs are leaked (ref count stays at 23151). Neal
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4