Skip to content
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

Free memory gives wrong result on linux #24

Open
b-spruck opened this issue Jul 20, 2017 · 6 comments
Open

Free memory gives wrong result on linux #24

b-spruck opened this issue Jul 20, 2017 · 6 comments

Comments

@b-spruck
Copy link

The free memory returned is not correct on linux. Problem: file system cache and buffers are counted as "free", but the system might not be able to free them on demand. Example: Any file residing in /dev/shm is counted as free memory.

reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=34e431b0ae398fc54ea69ff85ec700722c9da773

In osdMemUsage.c, summing of of items shoudl be replaced by the value of MemAvailable

@ralphlange
Copy link
Member

But only if the system's kernel is new enough to provide it.

@b-spruck
Copy link
Author

sure. is there a reason to stick to old kernels?

@ralphlange
Copy link
Member

Many installation use RHEL etc. which tend to update conservatively.
In terms of platform compatibility, EPICS code usually has to support 10-15 years of OS/compiler history.

@b-spruck
Copy link
Author

let me rephrase it, is there a reason NOT to support new kernel feature?

@b-spruck
Copy link
Author

else if (strcmp(title, "MemFree:") == 0 ||
strcmp(title, "Buffers:") == 0 ||
strcmp(title, "Cached:") == 0) {
memfree += value * 1024;
found++;
}else if (strcmp(title, "MemAvailable:") == 0) {
memfree = value * 1024;
found=99; // sorry depends on order ...

@ralphlange
Copy link
Member

I can't avoid not to think of reasons not to support new kernel features.

Yeah, something along that is obviously fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants