[PATCH][malloc] Improve malloc initialization sequence
DJ Delorie
dj@redhat.com
Mon Oct 2 22:01:00 GMT 2017
> - /*
> - If max_fast is 0, we know that av hasn't
> - yet been initialized, in which case do so below
> - */
The comment before the function needs to be edited as well.
> - if (get_max_fast () != 0) {
> + {
Mild preference for "touch all the lines, but get the indentation
right". The remaining {} block need not be a full {} block.
__libc_mallopt() calls malloc_consolidate, with a comment that says
"Ensure initialization/consolidation" - do we need to consolidate here,
or is it another remnant? Either way, at least the comment is wrong
now.
The comment for malloc_init_state() is also wrong now.
_int_malloc calls malloc_consolidate to initialize arenas, although it
also needs the consolidation feature.
comment in mtrim() is wrong now, or it needs to call init? (ok, pretty
much every call to malloc_consolidate needs to be checked to see if they
really are initializing the arenas; there are a lot of public APIs that
might be called before malloc/realloc/calloc, which is when
ptmalloc_init gets called)
I wonder if an assert in malloc_consolidate would be prudent...
More information about the Libc-alpha
mailing list