This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients pwuertz, rhettinger
Date 2020-03-23.19:01:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1584990115.97.0.0939268345559.issue40047@roundup.psfhosted.org>
In-reply-to
Content
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):
        next(p)
        next(q)
        print(i)
    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.
History
Date User Action Args
2020-03-23 19:01:55rhettingersetrecipients: + rhettinger, pwuertz
2020-03-23 19:01:55rhettingersetmessageid: <1584990115.97.0.0939268345559.issue40047@roundup.psfhosted.org>
2020-03-23 19:01:55rhettingerlinkissue40047 messages
2020-03-23 19:01:55rhettingercreate