[PATCH] D47358: <experimental/memory_resource>: Implement {un, }synchronized_pool_resource.
Arthur O'Dwyer via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 18 19:02:28 PDT 2018
Quuxplusone planned changes to this revision.
Quuxplusone added inline comments.
================
Comment at: src/experimental/memory_resource.cpp:240
+ bool allocation_contains(const char *p) const {
+ // TODO: This part technically relies on undefined behavior.
+ return allocation <= p && p < ((char*)allocation + bytes);
----------------
I now see how to avoid doing this: instead of keeping a separate free-list per each chunk, I should keep one big free-list per pool, where blocks from all chunks in the same pool are mixed together. This is okay because we never deallocate one chunk unless we're deallocating *all* chunks.
I'll rework the patch to eliminate this undefined behavior and keep a free-list per pool.
Repository:
rCXX libc++
https://reviews.llvm.org/D47358
More information about the cfe-commits
mailing list