script uses up all memory
marko at pacujo.net
Fri Mar 7 00:53:03 CET 2014
Chris Angelico <rosuav at gmail.com>:
> Can you give a useful example of a closure that does create a refloop?
Just the other day, I mentioned the state pattern:
sm = self
sm.state = AT_DOOR()
self.state = IDLE()
So we have:
-> MyStateMachine instance.ding
-> IDLE instance
-> IDLE instance.ding
-> MyStateMachine instance
plus numerous others in this example alone.
In general, event-driven programming produces circular references left
and right, and that might come into wider use with asyncio.
I suspect generators might create circular references as well.
Any tree data structure with parent references creates cycles.
In fact, I would imagine most OO designs create a pretty tight mesh of
More information about the Python-list