Skip to content

Commit

Permalink
Do allocate on 0 bytes allocations as standard.
Browse files Browse the repository at this point in the history
  • Loading branch information
cppguru committed Sep 13, 2019
1 parent 786385b commit 4497b88
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -267,3 +267,6 @@ CMakeCache.txt
CMakeFiles/
cmake_install.cmake
*.sln

# build
/out
9 changes: 0 additions & 9 deletions stdpmr/test_resource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -449,15 +449,6 @@ void *test_resource::do_allocate(size_t bytes, size_t alignment)
}
}

if (0 == bytes) {
m_last_allocated_num_bytes_.store(static_cast<long long>(0),
memory_order_relaxed);
m_last_allocated_alignment_.store(static_cast<long long>(alignment),
memory_order_relaxed);
m_last_allocated_address_.store(nullptr, memory_order_relaxed);
return nullptr; // RETURN
}

AlignedHeader *head = (AlignedHeader *)m_pmr_->allocate(
sizeof(AlignedHeader) + bytes + paddingSize);
if (!head) {
Expand Down

0 comments on commit 4497b88

Please sign in to comment.