I would like to read the free memory and automatically kill tasks to increase free memory
thank you
free RAM memory
Moderator: Martin
Re: free RAM memory
You could read the file /proc/meminfo to get some memory stats (action Init Variable Text File: /proc/meminfo) and use a script to extract the relevant part until a built-in action becomes available.
Regards
Martin
Regards
Martin
-
- Posts: 56
- Joined: 16 Mar 2013 14:10
Re: free RAM memory
After issuing three command Martin suggests, this code will calculate the free ram.
mem=split(stdout, "kB");
memfree=getElement(mem, 1);
memcached=getElement(mem, 3);
memfree=substring(memfree, indexOf(memfree, ":")+1, length(memfree));
memcached=substring(memcached, indexOf(memcached, ":")+1, length(memcached));
global_totalfree="{(memfree+memcached)/1024,numberformat,0}";
mem=split(stdout, "kB");
memfree=getElement(mem, 1);
memcached=getElement(mem, 3);
memfree=substring(memfree, indexOf(memfree, ":")+1, length(memfree));
memcached=substring(memcached, indexOf(memcached, ":")+1, length(memcached));
global_totalfree="{(memfree+memcached)/1024,numberformat,0}";