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.
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.