summaryrefslogtreecommitdiffstats
path: root/libtransport
diff options
context:
space:
mode:
authorMauro Sardara <msardara@cisco.com>2019-03-05 14:50:24 +0100
committerMauro Sardara <msardara@cisco.com>2019-03-05 14:50:24 +0100
commit6c2e28e281248c900892083ba8484b9d5aec8737 (patch)
tree61c11bdef40aa1423b4bb77ad3e4c1f531b4626e /libtransport
parent9d0002e5cb97d939f2f74ab1e635b616d634e7db (diff)
[HICN-89] Preallocate memory for timer handlers just with memif connector.
Change-Id: I74b3a249961390b6441c45c91dde21f587a426a5 Signed-off-by: Mauro Sardara <msardara@cisco.com>
Diffstat (limited to 'libtransport')
-rw-r--r--libtransport/src/hicn/transport/core/portal.h21
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