How to find total RAM available?

I'm curious whether anyone knows of a portable crate to find the amount of physical RAM available? I've found the procfs crate which should serve my needs, but I haven't found a search term that would describe what I need, so I'm wondering if I've missed another option.

How about sysinfo?

That looks like what I am after. Sadly, it doesn't document what the methods mean, esp. the distinction between free and available memory. :frowning:

I expect it's like the free command, where "free" is completely unused memory, and "available" includes cache memory that could be flushed without swapping. For example, many directory entries and file contents will be cached in memory, but that can be thrown away (LRU) if a process needs more memory, to be reloaded from disk if needed again later.

1 Like

That's my guess also (since that's the meaning of the item with the same name in/proc/meminfo) , but it would be much more encouraging if it were documented, particularly as this is a cross-platform crate, and thus its meaning ought to be defined in a cross platform way.

Well, you could file a bug asking for this. :slight_smile:

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.