Who is most garbage collected?

Alexander Petrovsky askjuise@REDACTED
Thu Oct 14 16:22:49 CEST 2021


Thanks, a lot, Lukas!

Could you clarify, please, one more thing? The doc says:

> wordsize
>
> For the gc_minor_start event it is the size of the need that triggered the GC. For the corresponding gc_minor_end event it is the size of reclaimed memory = start heap_size - end heap_size.

So, in case the wordsize is zero, why does erlang then do GC?

Shell got {trace_ts,<0.70.0>,gc_minor_start,
                    [{wordsize,0},
                     {old_heap_block_size,196650},
                     {heap_block_size,28690},
                     {mbuf_size,48},
                     {recent_size,1021},
                     {stack_size,127},
                     {old_heap_size,66369},
                     {heap_size,28529},
                     {bin_vheap_size,1040},
                     {bin_vheap_block_size,46422},
                     {bin_old_vheap_size,0},
                     {bin_old_vheap_block_size,46422}],
                    -576415474020493743}
Shell got {trace_ts,<0.70.0>,gc_minor_end,
                    [{wordsize,26982},
                     {old_heap_block_size,196650},
                     {heap_block_size,28690},
                     {mbuf_size,0},
                     {recent_size,819},
                     {stack_size,127},
                     {old_heap_size,67145},
                     {heap_size,819},
                     {bin_vheap_size,0},
                     {bin_vheap_block_size,46422},
                     {bin_old_vheap_size,0},
                     {bin_old_vheap_block_size,46422}],
                    -576415474020419312}


чт, 14 окт. 2021 г. в 09:33, Lukas Larsson <lukas@REDACTED>:

>
> Hello!
>
> On Wed, Oct 13, 2021 at 8:35 PM Alexander Petrovsky <askjuise@REDACTED> wrote:
>>
>> Hello!
>>
>> I wonder, what is the best way to find out the "culprit" of GC:
>>
>> > msacc:start(1000), msacc:print().
>>         Thread      aux check_io emulator       gc    other     port    sleep
>> ...
>>  scheduler( 1)    1.68%    1.12%   55.34%    9.05%    3.44%   13.91%   15.45%
>>  scheduler( 2)    1.53%    1.13%   55.17%    9.94%    4.76%    9.59%   17.88%
>>  scheduler( 3)    1.64%    1.21%   58.12%   10.88%    3.45%    8.93%   15.78%
>>  scheduler( 4)    1.61%    1.29%   57.22%   11.80%    3.97%    8.42%   15.69%
>> ...
>>
>> Using erlang:trace ang catch garbage_collection events?
>
>
> I would trace on garbage_collection events. By diffing the time from the gc_start to gc_end events it should give you a good idea of which processes it is that are doing the GC.
>
> Lukas



--
Alexander Petrovsky


More information about the erlang-questions mailing list