<div dir="ltr">And here's a gist with an Erlang reproduction: <a href="https://gist.github.com/devonestes/abe4dc60484e5426d4890c4494430194">https://gist.github.com/devonestes/abe4dc60484e5426d4890c4494430194</a>. When I run this escript as is, I see that the `recent_size` is different (which is only supposed to change after a GC run, right?) but no trace messages indicating that garbage collection took place. However, with this Erlang example, the `heap_block_size` and `old_heap_block_size` remain the same. When I bump up the size of the list I'm mapping over (ToMap) from 50 to 100, I see garbage collection trace messages indicating that a single minor collection took place.</div><br><div class="gmail_quote"><div dir="ltr">On Tue, Jul 31, 2018 at 8:08 PM Devon Estes <<a href="mailto:devon.c.estes@gmail.com">devon.c.estes@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Thanks so much for this! That's probably a good idea calling `erlang:garbage_collect()` and relying on the trace information. I'll play around with that to see how that affects things.</div><div><br></div>I'm seeing the behavior with the heap_block_size on this branch: <a href="https://github.com/PragTob/benchee/tree/memory-measurement-issues" target="_blank">https://github.com/PragTob/benchee/tree/memory-measurement-issues</a><div><br></div><div>We have some samples in there, usually to show how to use benchee, but I've added one to reproduce this issue (in `samples/wtf.exs`). If you run `mix run samples/wtf.exs`, you'll see the process_info data printed to the console, both before and after the function to be measured is run, and you won't see any indication that a garbage collection event happened. If you bump up the size of the range in the sample `samples/wtf.exs` to `1..5000`, you'll see that 9 GC runs take place (7 minor, 2 major).</div><div><br></div><div>Also, if it helps, the code around memory measurement is all in `lib/benchee/benchmark/measure/memory.ex`.</div><div><br></div><div>I'll try tomorrow to write this up in Erlang to reproduce it that way as well.</div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Jul 31, 2018 at 9:39 AM Lukas Larsson <<a href="mailto:lukas@erlang.org" target="_blank">lukas@erlang.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello,<br><br><div class="gmail_quote"></div></div><div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Fri, Jul 27, 2018 at 10:11 PM Devon Estes <<a href="mailto:devon.c.estes@gmail.com" target="_blank">devon.c.estes@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>I hope this helps jog some ideas as to what might be going on here, and thanks again for any help y'all can offer.</div></div></blockquote><div><br></div></div></div><div dir="ltr"><div class="gmail_quote"><div>I think I have figured out what is going on. It seems to be the allocation of the term containing the garbage_collection_info that is messing with measurements. I'll try to change the code inside process_info to give a more accurate view of the current memory usage, however as long as the call to process_info happens in the process doing the call there will be some miss match.</div><div><br></div><div>I would suggest that you instead do a call to erlang:garbage_collect() before and after the benchmark is run and rely on tracing to get the correct information. Alternatively you could call erlang:process_info on the process from the trace collector, though then you would need some type of synchronization in between the processes.</div><div><br></div><div>I have not been able to reproduce the scenario you mentioned where the heap_block_size is increased without getting a trace message. What code did you run to trigger that? As always an Erlang example would be preferable, but I should manage with an Elixir one as well.</div></div></div><div dir="ltr"><div class="gmail_quote"><div><br></div><div>Lukas</div></div></div></blockquote></div>
</blockquote></div>