[erlang-questions] Memory leak related to "driver_alloc"

Stanislaw Klekot erlang.org@REDACTED
Wed May 2 22:19:30 CEST 2018


On Wed, May 02, 2018 at 07:08:34PM +0200, Florian Odronitz wrote:
> Hi,
> 
> I am trying to debug what looks like a memory leak of about 6GB per week (~10kB/s).
> The node in question gets data from Kafka and Redis, processes it and puts the result back in Redis (~1MB/s in, 0.9MB/s out).
> 
> When I log into the node I see erlang:memory() reporting 14,6 GB of memory basically all attributed to "system".
> Digging deeper recon_alloc:memory(allocated_types) finds that basically all the memory is allocated by "driver_alloc".
[...]
> I thought maybe it is NIFs leaking memory so I tried to run them in
> isolation for around 30 CPU minutes each encoding/decoding or
> compressing/decompressing. They all seem fine.

If it's really driver_alloc(), then I wouldn't search among the NIFs,
but among the port drivers. Do you have any?

> I don't fully understand what driver_alloc contains and what could drive its growth.

driver_alloc() is, according to its documentation, a wrapper for
malloc(3), so it's not its own fault.

-- 
Stanislaw Klekot



More information about the erlang-questions mailing list