[erlang-questions] Understanding binary heap garbage collection

Ward Bekker (TTY) <>
Fri Nov 23 09:57:05 CET 2012


Hi,

After an operation with binaries, and manual requesting a garbage collect, the binary heap does not shrink to it's former size. See my test sequence below. About 1.5 MB is added to the binary heap, and never garbage collected. What can be the cause?

/W

=========

Erlang R15B02 (erts-5.9.2) [source] [64-bit] [smp:2:2] [async-threads:0] [hipe] [kernel-poll:false] [dtrace]

Eshell V5.9.2  (abort with ^G)
1> erlang:memory().
[{total,9654968},
 {processes,1123090},
 {processes_used,1123090},
 {system,8531878},
 {atom,194289},
 {atom_used,176885},
 {binary,1319320},
 {code,3892513},
 {ets,298400}]

2> lists:foldl(fun(_I, Acc) -> <<Acc/binary, Acc/binary>> end, <<"abc">>, lists:seq(0,21)).
<<"abcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcab"…>>

3> erlang:memory().
[{total,22340920},
 {processes,1127984},
 {processes_used,1127970},
 {system,21212936},
 {atom,202481},
 {atom_used,186083},
 {binary,13901920},
 {code,3972848},
 {ets,302504}]

4> erlang:garbage_collect().
true

5> erlang:memory().
[{total,22314232},
 {processes,1100552},
 {processes_used,1100538},
 {system,21213680},
 {atom,202481},
 {atom_used,186083},
 {binary,13902664},
 {code,3972848},
 {ets,302504}]
6> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20121123/7e40e2ef/attachment.html>


More information about the erlang-questions mailing list