From 6c2e28e281248c900892083ba8484b9d5aec8737 Mon Sep 17 00:00:00 2001 From: Mauro Sardara Date: Tue, 5 Mar 2019 14:50:24 +0100 Subject: [HICN-89] Preallocate memory for timer handlers just with memif connector. Change-Id: I74b3a249961390b6441c45c91dde21f587a426a5 Signed-off-by: Mauro Sardara --- libtransport/src/hicn/transport/core/portal.h | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'libtransport/src/hicn') 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 served_namespaces_; - portal_details::HandlerMemory async_callback_memory_; portal_details::Pool packet_pool_; + + portal_details::HandlerMemory async_callback_memory_; }; } // end namespace core -- cgit 1.2.3-korg