Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
More types of memory measurement (process heap size, retained memory) #262
In a recent blog post using benchee by @alvises I wondered why the author didn't use benchee for memory measurements so I reached out and it happens that what we measure doesn't seem to be what was important here:
The thing is that we measure the total memory allocated - even the memory that was garbage collected which is what we want :) However, it'd be interesting to see a couple of others:
The question is of course how to implement this - as our memory measurer already has all the data the simplest solution might be to just let it return the 3 values in a tuple or so.
Another interesting thing is the output - for a lot of use cases (pure functions) I expect all of these values to not change so instead of printing 3 different sections we could just output "this value this, that value that and the other value that"
This is a post 1.0 thing, it's very nice but we should really get 1.0 out and it shouldn't be breaking to the outside as we'd just add fields/data not remove or rename.
So I just opened #263 to make this maybe a bit more discoverable.
What you're looking for (and what too me more googling than it should have) is http://erlang.org/doc/man/erlang.html#gc_minor_start
Total memory used to the best of my understanding is
So that size after running the function and triggering GC should be the retained memory.
As for what is the total process size I'd have to half guess/dig deeper - heap_block_size + old_heap_block_size + stack_size?
I'm unsure but sadly don't have the time to read up on it.
Also @alvises great that you look at it, not to deter you but just wanna mention again that I think we'd most likely get this in for realz after 1.0 (gathering the values should be okay but displaying it in all the formatters would take quite some time so I see it more as a 1.1 right now but yes that means I should take the time to do 1.0