Skip to content

Get system buffer/cache memory #1630

Description

@MatteoNardi

The System::used_memory() method includes the buffer/cache memory.
This makes sense and it's probably the expected behavior.
I'd like to get the buffer/cache memory usage.

My use case

I develop an embedded application and I've added a resource usage monitor, which logs a warning when too many resources are getting used. Since it's a long-running application, I'm interested in detecting memory leaks. If my understanding of the Linux memory handling is correct, buffer and cache memories would be reclaimed by the operating system in case of need.
Because of this I want to exclude buffer and cache memory from my calculations, as they would increase even without a memory leak.

I understand this is quite an unusual use-case. Let me know if a PR would be welcome.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions