[issue4273] cycle created by profile.run
darrenr python-roun...@dranalli.com added the comment: I think we still need to prevent collectable cycles in our Python code. Here's the situation: We've got a process that creates many Python objects, and it needs to be responsive, it's not good for it to block on one operation for more than 100-200 ms. The automatic garbage collection is currently taking on the order of 2 seconds for this process. If we can guarantee that no collectable or non-collectable cycles are being created, we can gradually increase the collection threshold, or turn off the garbage collector entirely, reducing or eliminating the blocking overhead of garbage collection. ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4273 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4273] cycle created by profile.run
darrenr [EMAIL PROTECTED] added the comment: We've gotten into the habit of writing manual destructors to remove references like the one you wrote. I think explicit destruction is a useful paradigm when resource allocation is involved and it's important to manage the allocation's lifetime closely. However you've convinced me that it's OK to allow these types of reference cycles, and to make an effort to clean up only cycles involving instances with __del__ methods. I've been able to convince the team. Thanks for helping to clear this up. ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue4273 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4273] cycle created by profile.run
Amaury Forgeot d'Arc [EMAIL PROTECTED] added the comment: Closing issue as Not a bug. (but we can continue the discussion here...) -- resolution: - works for me status: open - closed ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue4273 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4273] cycle created by profile.run
Amaury Forgeot d'Arc [EMAIL PROTECTED] added the comment: But the garbage collector was invented for this very purpose: to break cycles! Take the following example which create a cycle for every instance of the class (the profile module has similar code): class C: def __init__(self): self.action = self.action_GO # cycle: the object's dict now contains a bound method # which references the object def action_GO(self): print(GO) This kind of construct is useful, and probably the best one in some cases. Would you ban it from your code? from the python standard library? Reference cycles are not bad at all, as long as they only hold memory: they will be reclaimed when the systems needs more memory. I agree that they can be a problem for other valuable resource: opened files, sockets, database cursors... even one thousand of uncollected sockets are not enough to trigger a collection. For this usage, I suggest that you iterate over gc.garbage, only warn for such objects and remove all others (and after, clear gc.garbage and run gc.collect() without the debug flag) ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue4273 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4273] cycle created by profile.run
Amaury Forgeot d'Arc [EMAIL PROTECTED] added the comment: Where is the problem, if these reference cycles are properly broken by the garbage collector *unless* you tell it not to? -- nosy: +amaury.forgeotdarc ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue4273 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4273] cycle created by profile.run
darrenr [EMAIL PROTECTED] added the comment: I work at a development house that has decided to tell gc to keep all cycles, in order to prevent any cycles from being created at all. It's analogous to the policy of keeping a C++ build warning-free. ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue4273 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4273] cycle created by profile.run
Winfried Plappert [EMAIL PROTECTED] added the comment: I tested profile_cycle.txt on both Python 2.5.2 and Python 2.6. The cycle you are showing for release 2.4.1 cannot be seen on both releases. Why dont't you try and upgrade to Python 2.6? -- nosy: +wplappert ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue4273 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4273] cycle created by profile.run
Benjamin Peterson [EMAIL PROTECTED] added the comment: Let's mark this as out of date then. -- nosy: +benjamin.peterson resolution: - out of date status: open - closed ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue4273 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4273] cycle created by profile.run
darrenr [EMAIL PROTECTED] added the comment: Issue also occurs in 2.6. Note that it only shows up if gc is set to save all cycles. -- versions: +Python 2.6 Added file: http://bugs.python.org/file11961/profile_cycle_26.txt ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue4273 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4273] cycle created by profile.run
Changes by Benjamin Peterson [EMAIL PROTECTED]: -- nosy: -benjamin.peterson resolution: out of date - status: closed - open ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue4273 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4273] cycle created by profile.run
New submission from darrenr [EMAIL PROTECTED]: The profile module creates a reference cycle. See attached session. -- components: Library (Lib) files: profile_cycle.txt messages: 75582 nosy: darrenr severity: normal status: open title: cycle created by profile.run type: resource usage versions: Python 2.4 Added file: http://bugs.python.org/file11956/profile_cycle.txt ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue4273 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4273] cycle created by profile.run
darrenr [EMAIL PROTECTED] added the comment: The profile module creates a reference cycle. See attached session. Note: cycle can be broken by deleting reference to 'dispatcher' on profile.Profile() instance. ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue4273 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com