[v3] allocator documentation revamp
Felix Yen
fwy@alumni.brown.edu
Thu Feb 12 03:04:00 GMT 2004
Benjamin, I'm flattered by the reference, and coincidentally, just
updated yalloc earlier today. (Support for reconfiguration was broken,
and it now implements Bonwick's coloring technique.) However, the
yalloc URL has a half-life of 1-2 months and I haven't decided if that
code will remain on the 'net afterward. There isn't enough interest in
it to justify adding it to SourceForge.
Stefan, I think removing the reference is probably the best solution.
In case you're wondering, yalloc differs from mt_allocator primarily in
three ways. First, yalloc doesn't use internal thread ids because I
wanted to support VC++ 6 and didn't want to use a third-party
implementation of Pthreads. After encountering several conformance
problems with that compiler and seeing how these ids contribute to
mt_allocator, I regret that decision as it produced yalloc's most
significant limitation.
Secondly, yalloc uses one bin per object size. This is primarily
because it is supposed to be used very sparingly, e.g. for fewer than
ten classes/containers in large systems. (This intended usage also
justifies using one mutex for the entire allocator and ignoring false
sharing.) Rounding object size to the next power of two is appropriate
for a default allocator, but it can create locality of reference
problems for the larger bins, as unrelated containers allocate memory
from the same free list. Even yalloc is impacted by this issue, but to
a lesser extent. (Nathan mentions the problem in his 1993 article.)
Thirdly, yalloc recycles entire free lists instead of blocks.
The minor differences include yalloc's introducing a linker dependency,
its use of coloring, and its support for overriding new/delete.
Felix
More information about the Libstdc++
mailing list