Author rhettinger
Recipients pwuertz, rhettinger
Date 2020-03-23.19:01:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Whats going on is that the implementation tracks blocks of 56 references at a time, freeing entire blocks at time.   So the memory release does occur periodically, but not as aggressively as it could. This code shows what is going on:

    # Show the timing of when objects are decreffed

    from itertools import tee

    class Notify:
        def __init__(self, x):
                self.x = x
        def __del__(self):
                print('<Clearing: %r>' % self.x)
        def __repr__(self):
                return 'Notify(%r)' % self.x

    it = map(Notify, range(100))
    p, q = tee(it)
    for i in range(100):
    print('Deleting it')
    del it
    print('Deleting p')
    del p
    print('Deleting q')
    del q

I'll look to see if the objects can be freed sooner without doing major brain surgery to the existing code.
Date User Action Args
2020-03-23 19:01:55rhettingersetrecipients: + rhettinger, pwuertz
2020-03-23 19:01:55rhettingersetmessageid: <>
2020-03-23 19:01:55rhettingerlinkissue40047 messages
2020-03-23 19:01:55rhettingercreate