Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Enable automatic garbage collection #9813

Closed
ShadowJonathan opened this issue Apr 14, 2021 · 5 comments
Closed

Enable automatic garbage collection #9813

ShadowJonathan opened this issue Apr 14, 2021 · 5 comments
Labels
T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks.

Comments

@ShadowJonathan
Copy link
Contributor

cc @erikjohnston, regarding the allocation mysteries where python is taking up more memory than it's actually using for objects.

According to @richvdh, the only reason why we're currently using manual GC is because python 2 didn't support gc.callbacks, using this to catch metrics instead might slightly improve performance elsewhere, such as in memory pressure and CPU usage, as we're giving cPython the reigns of the garbage collector again.

This might need some performance testing.

@erikjohnston
Copy link
Member

I think another reason is that we want to ensure that the CPU used doing the GC isn't reported as part of a log context? By triggering it manually we can ensure that it happens in the sentinel log context, though that may be possible with the callbacks too.

Given the reactor ticks around (hopefully) more frequently than we do GCs, I don't think it makes any difference.

@clokep clokep changed the title Switch from manual GC to using gc.callbacks Enable automatic garbage collection Apr 14, 2021
@clokep clokep added the T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks. label Apr 14, 2021
@clokep
Copy link
Member

clokep commented Apr 14, 2021

I re-worded this a bit. The task is to stop using manual GC and to switch to the automatic GC. The way to do this is by using gc.callbacks.

@erikjohnston
Copy link
Member

I'm not sure why we'd want to bother? I don't see what automatic GC will buy us?

@clokep
Copy link
Member

clokep commented Apr 14, 2021

Hah, well that's why I reworded. Is the task here to switch to automatic GC or to switch to using gc.callbacks? 😄 B is a pre-req for A, but doesn't necessarily imply that we should be doing A.

@richvdh
Copy link
Member

richvdh commented Jan 10, 2022

#9902 added a gc_min_seconds_between config setting, which requires GC to be manual, so I don't think this is something we want to do.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks.
Projects
None yet
Development

No branches or pull requests

4 participants