Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32k
gh-132917: Use RSS + swap for estimate of process memory usage#133464
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Exquisite |
893034c
intopython:mainUh oh!
There was an error while loading.Please reload this page.
Yikes, reading a file in /proc to determine whether the GC should run? That feels... ugh. Also, we primarily care about allocations offrom Python, right? Doesn't mimalloc already have enough information to tell us the total heap size or something? |
Well that's technically the official Linux interface to get this info so as long as you like the approach of making GC runs depend on memory watermark this is the correct way.
Yep, See also my comment in#133399 (review) On the other hand we don't necessarily want to count Python only memory. If an object holds a big buffer allocated by malloc you also want to delete that object anyway. Is a less clear cut that the GC actually will do anything but is also not correct to say that's independent. |
It only happens when |
Hrm. Okay, different observation then: aren't we now running the risk ofevery thread reading the file (and doing all the work of checking the limits) in order to schedule the GC,even if it's already scheduled? I mean, we did that before as well, but that was when "all the work" was just checking a couple of oft-used memory locations. Now it actually consumes system resources (open files), which feels more fraught. Should we skip doing the check if the GC is already scheduled (or even "already being checked")? |
I still think a hybrid approach is best where we can weight the mimalloc side independently in the general resident size. |
Uh oh!
There was an error while loading.Please reload this page.
This is a small refinement ofGH-133399. Including the swap usage as well as the RSS is a good idea in case some pages of the process got swapped out. Doing this in a cross-platform way is a bit challenging but this PR should on Linux, MacOS, and Windows at least. For OpenBSD and FreeBSD, we just use RSS.
📚 Documentation preview 📚:https://cpython-previews--133464.org.readthedocs.build/