jemalloc/jemalloc — pull request #64 by bmaurer (2014-04-02 03:11:55+00:00)
Title: Cleanup profiling code

Jason -- wanted to get some feedback from you on this. I haven't tested it very well and there's also one FIXME, but wanted to see what you thought of the overall approach.

This diff cleans up the profiling code in two ways:

(1) It turns the two part prepare-commit process into a one step
process. This is good because it could make it easier to reduce
code duplication in the future. For example, today multiple copies
of arena_malloc are inlined inside malloc(). This could make it
easier to de-duplicate these inlined versions.

In a few exceptional codepaths (eg realloc with an alignment
constraint where the allocation is resized but not moved or OOM)
we simply reset the sampling code rather than try to account for
things correctly.

(2) replaces the 2 variable accumulated / threshold accounting
with a 1 variable bytes until sample. This is the same as the
way tcmalloc does the accounting.