[erlang-questions] Hidden binaries

Lukas Larsson lukas@REDACTED
Wed May 28 10:26:41 CEST 2014


Binaries can also be present in ets objects and messages in processes'
message queues. I'm sure there are some other places as well, but those
should be the major ones.

I know of no easy way (with gdb or otherwise) to get information if this is
the case.

On Wed, May 28, 2014 at 9:07 AM, Kirill Zaborsky <qrilka@REDACTED> wrote:

> Hello,
> I have recently found some memory "leak" in our application. Leak is in
> quotes because memory load seems to be constant under constant load. But
> the problem is that I see some extra binaries for which there are no signs
> in process_info.
> In production we use our fork of OTP16BR3-1 (including some number of
> httpc fixes) but it looks like that behaviour could be reproduced locally
> on my machine with OTP 17.
> I have tried to get any hints from recon but with not success.
> The problem could be seen from the following Erlang shell lines:
> -------------
> (node@REDACTED)87> recon:bin_leak(20),erlang:memory().
> [{total,30574120},
>  {processes,6765096},
>  {processes_used,6738520},
>  {system,23809024},
>  {atom,662409},
>  {atom_used,652067},
>  {binary,145760},
>  {code,16742599},
>  {ets,1037976}]
> (node@REDACTED)88>
> lists:sum([N||{P1,N,B}<-[{P,lists:sum([S||{_,S,_}<-B]),B} || {P,{binary,B}}
> <- [{Pid,(catch process_info(Pid,binary))} || Pid <- processes()]]]).
> 17671
> (node@REDACTED)89>
> -------------
> As you see erlang:memory/0 shows 146k of memory used by binaries but
> erlang:process_info/2 shows information only about 18k
> Is there any way I could find out where the missing 128k of memory is?
> Is it possible to get all binaries contents without gowing to some
> low-level tools like gdb (I'm not quite familiar with it yet)?
> Possibly there are some system-level binaries?
> In production I see not kilobytes but hunderds of megabytes and sometimes
> it leads even to OOM crashes.
> I run Gentoo on my desktop and in production we use Ubuntu Precise.
> Thanks for any advice.
> Best regards,
> Kirill Zaborsky
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20140528/cba4f9e7/attachment.htm>

More information about the erlang-questions mailing list