aboutsummaryrefslogtreecommitdiffstats
path: root/libtransport/includes/hicn/transport/utils/fixed_block_allocator.h
diff options
context:
space:
mode:
authorMauro <you@example.com>2021-06-30 07:57:22 +0000
committerMauro Sardara <msardara@cisco.com>2021-07-06 16:16:04 +0000
commit08233d44a6cfde878d7e10bca38ae935ed1c8fd5 (patch)
tree7ecc534d55bdc7e8dd15ecab084720910bcdf4d9 /libtransport/includes/hicn/transport/utils/fixed_block_allocator.h
parent147ba39bed26887f5eba84757e2463ab8e370a9a (diff)
[HICN-713] Transport Library Major Refactoring 2
Co-authored-by: Luca Muscariello <muscariello@ieee.org> Co-authored-by: Michele Papalini <micpapal@cisco.com> Co-authored-by: Olivier Roques <oroques+fdio@cisco.com> Co-authored-by: Giulio Grassi <gigrassi@cisco.com> Signed-off-by: Mauro Sardara <msardara@cisco.com> Change-Id: I5b2c667bad66feb45abdb5effe22ed0f6c85d1c2
Diffstat (limited to 'libtransport/includes/hicn/transport/utils/fixed_block_allocator.h')
-rw-r--r--libtransport/includes/hicn/transport/utils/fixed_block_allocator.h21
1 files changed, 3 insertions, 18 deletions
diff --git a/libtransport/includes/hicn/transport/utils/fixed_block_allocator.h b/libtransport/includes/hicn/transport/utils/fixed_block_allocator.h
index b1df36493..298b6f9d1 100644
--- a/libtransport/includes/hicn/transport/utils/fixed_block_allocator.h
+++ b/libtransport/includes/hicn/transport/utils/fixed_block_allocator.h
@@ -35,7 +35,6 @@ class FixedBlockAllocator
if (!p_block) {
if (TRANSPORT_EXPECT_FALSE(current_pool_index_ >= max_objects_)) {
// Allocate new memory block
- TRANSPORT_LOGV("Allocating new block of %zu size", SIZE * OBJECTS);
p_pools_.emplace_front(
new typename std::aligned_storage<SIZE>::type[max_objects_]);
// reset current_pool_index_
@@ -151,10 +150,7 @@ class STLAllocator {
using value_type = T;
STLAllocator(pointer memory, Pool* memory_pool)
- : memory_(memory), pool_(memory_pool) {
- TRANSPORT_LOGV("Creating allocator. This: %p, memory: %p, memory_pool: %p",
- this, memory, memory_pool);
- }
+ : memory_(memory), pool_(memory_pool) {}
~STLAllocator() {}
@@ -173,28 +169,17 @@ class STLAllocator {
const_pointer address(const_reference x) const { return &x; }
pointer allocate(size_type n, pointer hint = 0) {
- TRANSPORT_LOGV(
- "Allocating memory (%zu). This: %p, memory: %p, memory_pool: %p", n,
- this, memory_, pool_);
return static_cast<pointer>(memory_);
}
- void deallocate(pointer p, size_type n) {
- TRANSPORT_LOGV("Deallocating memory. This: %p, memory: %p, memory_pool: %p",
- this, memory_, pool_);
- pool_->deallocateBlock(memory_);
- }
+ void deallocate(pointer p, size_type n) { pool_->deallocateBlock(memory_); }
template <typename... Args>
void construct(pointer p, Args&&... args) {
new (static_cast<pointer>(p)) T(std::forward<Args>(args)...);
}
- void destroy(pointer p) {
- TRANSPORT_LOGV("Destroying object. This: %p, memory: %p, memory_pool: %p",
- this, memory_, pool_);
- p->~T();
- }
+ void destroy(pointer p) { p->~T(); }
private:
void* memory_;