Skip to content


Subversion checkout URL

You can clone with
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
Checking mergeability… Don’t worry, you can still create the pull request.
  • 1 commit
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Commits on Sep 03, 2013
@dotsimon dotsimon Fix inconsistency in free_memory value on Linux platforms
The documentation for memsup:get_system_memory_data() states the
free_memory element contains the "amount of free memory available to
the Erlang emulator for allocation". However later a note states that
this is not true for Linux.

This patch corrects the inconsistency by adding the memory allocated by
kernel buffers and caches back to the kernel "free" value. It also
modifies the note to the effect that these value are included in

With this patch, a user application that monitors and/or reports free
memory can rely on the meaning of free_memory to be consistent across
deployed platforms.
Showing with 5 additions and 3 deletions.
  1. +3 −1 lib/os_mon/c_src/memsup.c
  2. +2 −2 lib/os_mon/doc/src/memsup.xml
4 lib/os_mon/c_src/memsup.c
@@ -442,7 +442,9 @@ get_basic_mem(unsigned long *tot, unsigned long *used, unsigned long *pagesize){
*tot =;
*pagesize = me.pagesize;
- *used = -;
+ *used = -
+ + (me.flag & F_MEM_BUFFERS ? me.buffered : 0)
+ + (me.flag & F_MEM_CACHED ? me.cached : 0);
#elif defined(BSD4_4)
struct vmtotal vt;
long pgsz;
4 lib/os_mon/doc/src/memsup.xml
@@ -209,8 +209,8 @@
<p>Returns the empty list [] if <c>memsup</c> is not available,
or if the memory check times out.</p>
- On linux the memory available to the emulator is <c>cached_memory</c> and <c>buffered_memory</c> in addition to
- <c>free_memory</c>.</p>
+ On linux the memory available to the emulator in <c>free_memory</c>
+ includes <c>cached_memory</c> and <c>buffered_memory</c>.</p>

No commit comments for this range

Something went wrong with that request. Please try again.