Skip to content
This repository has been archived by the owner on Nov 23, 2017. It is now read-only.

Do we need to call gc.collect() occasionally through the event loop? #42

GoogleCodeExporter opened this issue Apr 10, 2015 · 5 comments


Copy link

I closed issue 41 as fixed, but there's one missing piece: abandoned tracebacks 
only get printed when the Future is garbage-collected.  If nothing else is 
going on this may take a while.  Perhaps we should have some heuristic in 
_run_once() that occasionally calls gc.collect()?

Every time _run_once() is called is probably too often -- maybe we should call 
it at most once a second?

Original issue reported on by on 3 May 2013 at 10:20

Copy link

Original comment by on 16 Oct 2013 at 4:42

  • Added labels: Priority-Low
  • Removed labels: Priority-Medium

Copy link

This came up again in the context of a CPython issue:

However, Victor wrote there: "I don't like such task. The issue can be 
documented, maybe with an example of call calling gc.collect() regulary? Such 
background task should be implemented in the application to control when the 
garbage collector is called."

Original comment by on 20 Dec 2013 at 10:39

  • Changed state: New

Copy link

I think it's a job for a higher level code -- i.e. an HTTP server can call 
gc.collect() when the rate of new requests is low etc. Putting this into the 
loop directly, where we don't have enough context about the actual task the 
loop is performing, is IMHO, redundant.

Original comment by on 11 Feb 2014 at 12:56

Copy link

OTOH what is the cost? (I honestly don't know how efficient calling 
gc.collect() frequently is, these days. And I suppose that when a server is the 
most busy, that's when it might be needed the most, and it would be called 
relatively infrequently.)

Original comment by on 11 Feb 2014 at 1:05

Copy link

Original comment by on 18 Jun 2014 at 12:48

  • Changed state: Duplicate

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet

No branches or pull requests

1 participant