Skip to content

Commit cb0fd8a

Browse files
committed
Add todo addressing embedded assumption about allocator fallback
Signed-off-by: James Buckland <[email protected]>
1 parent aeb9251 commit cb0fd8a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

source/common/stats/thread_local_store.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,11 @@ StatType& ThreadLocalStoreImpl::ScopeImpl::safeMakeStat(
182182
make_stat(parent_.alloc_, name, std::move(tag_extracted_name), std::move(tags));
183183
if (stat == nullptr) {
184184
parent_.num_last_resort_stats_.inc();
185+
// TODO(jbuckland) Performing the fallback from non-heap allocator to heap allocator should be
186+
// the responsibility of the non-heap allocator, not the client of the non-heap allocator.
187+
// This branch will never be used in the non-hot-restart case, since the parent_.alloc_ object
188+
// will throw instead of returning a nullptr; we should remove the assumption that this
189+
// branching case is always available.
185190
stat =
186191
make_stat(parent_.heap_allocator_, name.substr(0, parent_.statsOptions().maxNameLength()),
187192
std::move(tag_extracted_name), std::move(tags));

0 commit comments

Comments
 (0)