[Python-bugs-list] Assigning function objects to instance variable causes memory leak (PR#346)
Mark Hammond
mhammond@skippinet.com.au
Tue, 6 Jun 2000 09:54:29 +1000
John also mailed me this personally. I have already responded that this is
not a bug, but a known circular reference, and outlined a few ways aound
it.
Mark.
> -----Original Message-----
> From: python-bugs-list-admin@python.org
> [mailto:python-bugs-list-admin@python.org]On Behalf Of
> jparkey@rapidbs.com
> Sent: Tuesday, 6 June 2000 2:07 AM
> To: python-bugs-list@python.org
> Cc: bugs-py@python.org
> Subject: [Python-bugs-list] Assigning function objects to instance
> variable causes memory leak (PR#346)
>
>
> Full_Name: John Parkey
> Version: 1.5.2
> OS: NT (build 132)
> Submission from: mail.rapidbs.com (195.92.50.66)
>
>
> Assigning a function object to an instance variable leaks
> memory. Run the
> programme below with the Windows task manager up to see the effect.
>
>
> class fred:
> def __init__(self):
> self.indirectFunc = self.theFunc
>
> def theFunc(self):
> return "blah"
>
> def test():
> f = fred()
> del f
>
>
> if __name__ == "__main__":
> for x in xrange(1000):
> test()
>
>
>
>
> _______________________________________________
> Python-bugs-list maillist - Python-bugs-list@python.org
> http://www.python.org/mailman/listinfo/python-bugs-list
>