-
-
Notifications
You must be signed in to change notification settings - Fork 335
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rename memory method #1124
Comments
I think the best solution here would to actually improve the documentation. Meaning that first we should tell that I don't think renaming |
Well, if they don't know what RSS is presently they're calling a method without any idea of what it returns. More precisely, they make up their minds using the method name (like: this is the memory allocated by the process), and get something completely different. I mean, I know what a RSS is, but I would have never thought that |
I think it's pretty rare for people to be interested into virtual memory. The |
I disagree. If you perform a large allocation (my case: 500GB) it does not show in the RSS until you actually write to those pages. This can be extremely misleading because using If I do a calloc for 500GB I'm definitely using that memory. But it won't show up in Linux with I realize this is a mess—for example, on MacOS the virtual memory is ridiculously large (1/2TB) even for the smallest process, and in fact the RSS info is more relatable to the memory "effectively used". But this is another proof that "effectively used" is very hard to define cross-OS, so a technically more precise name would be preferrable. But it's your crate (BTW: thanks, incredibly useful crate!), so you call the shots. |
I didn't know that. I thought the memory was counted as RSS as soon as you wrote into the pages.
That's why I suggested to update documentation rather than updating the method name. If the number seems off, people will likely come back to the documentation trying to see if there is more information. I prefer to make it easy to find something, even if not exactly accurate. Documentation is there to provide more context (which it currently doesn't, which is very bad and I'm quite happy you opened an issue about this!). So although your arguments make perfect sense, I hope my position and logic make sense to you as to why I'd rather keep the method name as is.
Glad it's helpful to you! In any case, a PR to improve documentation would be very welcome! |
Since #1125 got merged, I think we can close this issue. Thanks a lot for the doc improvement! :) |
I suggest that the
Process::memory
method is renamedresident_memory
, or anything that makes it clear that is not the method returning all the memory used by the process.It is just an ergonomics problem—having found
memory
with autocompletion I thought that would returned all the memory, virtual or not, swapped or not, owned by the process. The documentation doesn't explain what is returned, either. Finally, after reading the blog entry, I understood thatmemory
returns just the RSS. So, essentiallymemory
returns a subset ofvirtual_memory
.Alternatively, one can just explain in the documentation that
memory
returns only the resident set, but I think people will still get confused.My use case is that was doing a half-terabyte allocation under Linux and I couldn't see it in
memory
.I can open a PR with a
resident_memory
method that deprecates the previousmemory
method if you're interested.The text was updated successfully, but these errors were encountered: