Different Process memory values

Hi,
I have a simple elixir project set up and I am wondering why I am seeing different memory usage values when I run the following commands:

Running :erlang.memory(:processes_used), I get 9555432.

But when I run Process.list() |> Enum.map(fn p -> Process.info(p, :memory) end) |> Enum.map(fn {:memory, val} -> val end) |> Enum.sum(), I get 6159636, which is considerably less.

Does anyone know the reason for this?

2 Likes

:erlang.memory(:processes_used) also includes other metadata used by processes. For instance the memory of the process table. You can check this by passing the +P option to Erlang and see how the memory usage changes.

7 Likes