This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug malloc/14581] memalign allocations are often not reused after free


https://sourceware.org/bugzilla/show_bug.cgi?id=14581

--- Comment #13 from Florian Weimer <fweimer at redhat dot com> ---
(In reply to Rich Felker from comment #12)
> Since last looking at this issue, I've been thinking about allocator designs
> to avoid fragmentation, and Florian's latest idea in comment 11 matches my
> current view on what's likely to be best. However it does seem to waste up
> to half of the memory consumed (i.e. up to 100% overhead) for the duration
> that it's allocated.

Right.  I thought it would be possible to avoid this, but it doesn't look like
it is.

> This is probably the right tradeoff still when the
> alternative is permanent-ish fragmentation for the process lifetime, but
> maybe there are ways to make it better/less-costly.

Other approaches would be to search for a smaller, sufficiently aligned
allocation.  This might not be so bad with the current glibc allocator and its
unsorted bins.

Or we could use a separate allocator for aligned allocations which has separate
freelists for different alignments, and sorts the freelist bins by size and
alignment.  However, this will prevent us from reusing memory which has been
used for aligned allocations for unaligned ones.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]