mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
gh-132917: Check resident set size (RSS) before GC trigger. (gh-133399)
For the free-threaded build, check the process resident set size (RSS) increase before triggering a full automatic garbage collection. If the RSS has not increased 10% since the last collection then it is deferred.
This commit is contained in:
parent
8e08ac9f32
commit
5c245ffce7
4 changed files with 230 additions and 5 deletions
|
@ -245,6 +245,16 @@ struct _gc_runtime_state {
|
|||
|
||||
/* True if gc.freeze() has been used. */
|
||||
int freeze_active;
|
||||
|
||||
/* Resident set size (RSS) of the process after last GC. */
|
||||
Py_ssize_t last_rss;
|
||||
|
||||
/* This accumulates the new object count whenever collection is deferred
|
||||
due to the RSS increase condition not being meet. Reset on collection. */
|
||||
Py_ssize_t deferred_count;
|
||||
|
||||
/* Mutex held for gc_should_collect_rss(). */
|
||||
PyMutex mutex;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue