diff options
author | Alberto Compagno <acompagn+fdio@cisco.com> | 2019-03-06 14:36:40 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@fd.io> | 2019-03-06 14:36:40 +0000 |
commit | b980b4384d610e64e4c8bdd749a6e8fb0ebd5117 (patch) | |
tree | ecb1ac4ae22501b05aeec4765ecbea5b4712114f | |
parent | ef3b8c5835ee7d4504640fd18b9a91ce76ec62a0 (diff) | |
parent | 6c2e28e281248c900892083ba8484b9d5aec8737 (diff) |
Merge "[HICN-89] Preallocate memory for timer handlers just with memif connector."
-rw-r--r-- | libtransport/src/hicn/transport/core/portal.h | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/libtransport/src/hicn/transport/core/portal.h b/libtransport/src/hicn/transport/core/portal.h index 4abcbe2cd..cadf37e8c 100644 --- a/libtransport/src/hicn/transport/core/portal.h +++ b/libtransport/src/hicn/transport/core/portal.h @@ -48,7 +48,8 @@ namespace portal_details { static constexpr uint32_t pool_size = 2048; class HandlerMemory { - static constexpr std::size_t memory_size = 1024 * 1024; +#ifdef __vpp__ + static constexpr std::size_t memory_size = 1024 * 512; public: HandlerMemory() : index_(0) { } @@ -65,6 +66,21 @@ class HandlerMemory { // Storage space used for handler-based custom memory allocation. typename std::aligned_storage<128>::type storage_[memory_size]; uint32_t index_; +#else + public: + HandlerMemory() { } + + HandlerMemory(const HandlerMemory&) = delete; + HandlerMemory& operator=(const HandlerMemory&) = delete; + + TRANSPORT_ALWAYS_INLINE void* allocate(std::size_t size) { + return ::operator new(size); + } + + TRANSPORT_ALWAYS_INLINE void deallocate(void* pointer) { + ::operator delete(pointer); + } +#endif }; // The allocator to be associated with the handler objects. This allocator only @@ -506,8 +522,9 @@ class Portal { ForwarderInt forwarder_interface_; std::list<Prefix> served_namespaces_; - portal_details::HandlerMemory async_callback_memory_; portal_details::Pool packet_pool_; + + portal_details::HandlerMemory async_callback_memory_; }; } // end namespace core |