Skip to content

Include cached memory into usable memory calculation#10

Merged
wernerfred merged 3 commits into
wernerfred:masterfrom
kreativekrise:patch-1
Feb 16, 2021
Merged

Include cached memory into usable memory calculation#10
wernerfred merged 3 commits into
wernerfred:masterfrom
kreativekrise:patch-1

Conversation

@kreativekrise
Copy link
Copy Markdown
Contributor

The memory calculation should also count cached memory into unused memory, because cached memory will be freed when applications require it.

The memory calculation should also count cached memory into unused memory, because cached memory will be freed when applications require it.
@wernerfred wernerfred self-assigned this Feb 16, 2021
@wernerfred
Copy link
Copy Markdown
Owner

Hey, thanks for your contribution.
Technically speaking cached memory isn't free (it's cached ;). But I get your point.
Thinking about existing (historical) data it might not seem a good idea to change the calculation of free memory.
What do you think about calling it usable memory from now on? Like this:

OK - 70.7% usable (232.4 MB free and 1032.0 cached out of 1828.1 MB) |memory_total=1871928c memory_unused=1323004c memory_percent=70% memory_cached=1031928c

@kreativekrise
Copy link
Copy Markdown
Contributor Author

Yes, that makes totally sense. Since I don't use historical data yet, I didn't thought on that use case.

@wernerfred
Copy link
Copy Markdown
Owner

wernerfred commented Feb 16, 2021

Please take a look at my update, check it at your environment and provide feedback.
If everything works I will merge the PR

@wernerfred wernerfred added the waiting for contributor action Waiting for the contributor to respond label Feb 16, 2021
Copy link
Copy Markdown
Contributor Author

@kreativekrise kreativekrise left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes work without any problem.

@wernerfred
Copy link
Copy Markdown
Owner

Keep in mind that if #9 gets merged you need to update your check command ;)

@wernerfred wernerfred changed the title Include cached memory into unused memory calculation Include cached memory into usable memory calculation Feb 16, 2021
@wernerfred wernerfred merged commit e3c0d26 into wernerfred:master Feb 16, 2021
@wernerfred
Copy link
Copy Markdown
Owner

@all-contributors please add @kreativekrise for code

@allcontributors
Copy link
Copy Markdown
Contributor

@wernerfred

I've put up a pull request to add @kreativekrise! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

waiting for contributor action Waiting for the contributor to respond

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants