Open
Conversation
1106214 to
0df3723
Compare
0df3723 to
ea268d3
Compare
|
Any news here? |
pbnjay
reviewed
May 16, 2022
| // The total available memory is the free memory + freeable memory | ||
| // such as buffer and cache. | ||
| // | ||
| // If available memory size could not be determined, then 0 is returned. |
Owner
There was a problem hiding this comment.
"If freeable memory size could not be determined, then freeable memory is assumed to be 0"
Seems to fit the semantics of the windows/bsd/darwin stubs a bit better.
Owner
I haven't had time to look into Darwin/BSD implementations. Should be straightforward just need to find/confirm which names to use in the syscalls |
SuperQ
reviewed
Jan 7, 2024
| // Buffer/cache ram is included on linux since the kernel | ||
| // will free this memory for applications if needed, and tends | ||
| // to use almost all free memory for itself when it can. | ||
| return (uint64(in.Freeram) + uint64(in.Bufferram)) * uint64(in.Unit) |
There was a problem hiding this comment.
On Linux it's generally better to use MemAvailable from /proc/meminfo. There is a good justification for this in the Linux kernel git commit.
The hard part is there's no simple stdlib syscall that I am aware of that can read this. 🙁
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
From the discussion in #9, this is the AvailableMemory() function addition.
It intends to return free+freeable memory.
I think Windows is ready to go as-is, and this adds the change for Linux. Darwin and BSDs remain and I could use some help there.