Ejabberd: Memory difference between erlang process and Linux
I am running ejabberd 2.1.10 server on Linux (Erlang R14B 03). I am creating XMPP connections using the tool in batches and sending a message randomly. ejabberd accepts most connections. Although connections are constantly growing, the erlang: memory (total) value is expected to be in range.
But if I check the memory usage of the ejabberd process with the top command, I can see that the memory usage of the ejabberd process is constantly increasing.
I can see that the difference between erlang: memory (total) values ββand memory usage displayed by the top command is constantly increasing.
Please let me know the reason for the difference in the shown memory. Is it due to a memory leak? Is there a way to debug this issue? What is extra memory (difference between erlang and top command) used if it is not a memory leak?
source to share
A memory error in the Erlang VM itself or in the non-erlang parts of ejabberd will have the effect you describe. ejabberd contains some NIFs - there are 10 ".c" files in ejabberd-2.1.10.
Has your ejabberd been configured for "--enable-nif"? If so, try comparing with the version built with "--disable-nif" to see if it has memory usage behavior.
Other debugging options include using Valgrind for leak detection and detection. (I haven't tried using it in an Erlang VM, there may be a few false positives, but with a little luck, the leak is highlighted either by size or by source.)
One final note: the Erlang process heap can be fragmented. Gaps between distributions will count towards the OS size; It doesn't look like they are included in erlang: memory (total).
source to share