The instrument module (and memory handling in general)

The instrument man page ( Erlang -- instrument ) has a Note at the top saying that it is experimental and likely to change in the future.
Is that still the case?

Also, it would be nice if the output could be better typed and explained.
For example: “Type is the allocation category that the blocks belong to, e.g. db_term, message or binary.” Immediately raises the question, what other categories are there? The example output from intrument:carriers() doesn’t seem to correspond to the type-declaration etc.

I also wonder if there exist some Best Practices when it comes to tuning a system with regards to memoy usage? (I’ve read some war-stories from Herouku etc, watched Lukas presentation from 2014, read Happis book about memory management, but they are all pretty old; so are there any more recent treatment of this topic?)

Cheers, Tobbe


with experimental we mean that the API is not stable yet, it might be changed in an incompatible way.

But the intention with this feature is that you use it for debugging and not in production. So a slightly incompatible change should not cause other than minor problems.

when it comes to tuning a system it need a much longer text than I want to write right now on my phone. So let us come back on that topic.

Regarding the documentation of the instrument API , I think we can improve it.


Perhaps I should create a new post for this?
Anyway; the erts_alloc doc-page (Erlang -- erts_alloc) say:

“sys_alloc, literal_alloc and temp_alloc are always enabled and cannot be disabled.”

but temp_alloc does not seem to always be enabled?
at least if you look at the output from the intrument:carriers/0 function.

To Reproduce:

erl +Mue true

ok,{_,L}} = instrument:carriers(), lists:usort([element(1,X) || X ← L]).

(no temp_alloc shown above)

erl +Mue true +MTe true

{ok,{_,L}} = instrument:carriers(), lists:usort([element(1,X) || X ← L]).

(now temp_alloc is shown)

According to the documentation temp_alloc should always be enabled but there doesn’t seem to be the case. Perhaps there are some other reason for it to not show up in the output from the instrument module?

Affected versions:
Erlang/OTP 22 [erts-]