Skip to content

Commit

Permalink
Merge pull request #79 from budrus/iox-#78-reduction-memory-consumption
Browse files Browse the repository at this point in the history
iox-#78: adaptations for reduction of memory consumption
  • Loading branch information
budrus authored Mar 28, 2020
2 parents e588ccb + 5b509b7 commit 80c5ae5
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 14 deletions.
4 changes: 4 additions & 0 deletions iceoryx_posh/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,10 @@ if(roudi_environment OR test)
)
endif(roudi_environment OR test)

if(ICEORYX_LARGE_DEPLOYMENT)
add_definitions(-DICEORYX_LARGE_DEPLOYMENT)
endif(ICEORYX_LARGE_DEPLOYMENT)

#
########## exporting library ##########
#
Expand Down
8 changes: 6 additions & 2 deletions iceoryx_posh/include/iceoryx_posh/iceoryx_posh_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,14 @@ constexpr units::Duration PROCESS_KEEP_ALIVE_INTERVAL = 3 * DISCOVERY_INTERVAL;
constexpr units::Duration PROCESS_KEEP_ALIVE_TIMEOUT = 5 * PROCESS_KEEP_ALIVE_INTERVAL; // > PROCESS_KEEP_ALIVE_INTERVAL

// Communication Resources
#ifdef ICEORYX_LARGE_DEPLOYMENT
constexpr uint32_t MAX_PORT_NUMBER = 4096u;
constexpr uint32_t MAX_INTERFACE_NUMBER = 16u;
#else
constexpr uint32_t MAX_PORT_NUMBER = 1024u;
#endif
constexpr uint32_t MAX_INTERFACE_NUMBER = 4u;
constexpr uint32_t MAX_RECEIVERS_PER_SENDERPORT = 256u;
constexpr uint32_t MAX_SAMPLE_ALLOCATE_PER_SENDER = 16u;
constexpr uint32_t MAX_SAMPLE_ALLOCATE_PER_SENDER = 8u;
constexpr uint64_t MAX_SENDER_SAMPLE_HISTORY_CAPACITY = 16u;
constexpr uint32_t MAX_RECEIVER_QUEUE_CAPACITY = 256u;
constexpr uint32_t MAX_INTERFACE_CAPRO_FIFO_SIZE = MAX_PORT_NUMBER;
Expand Down
12 changes: 4 additions & 8 deletions iceoryx_posh/source/mepoo/mepoo_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,13 @@ void MePooConfig::addMemPool(MePooConfig::Entry f_entry) noexcept
/// this is the default memory pool configuration if no one is provided by the user
MePooConfig& MePooConfig::setDefaults() noexcept
{
m_mempoolConfig.push_back({32, 10000});
m_mempoolConfig.push_back({128, 10000});
m_mempoolConfig.push_back({1024, 2000});
m_mempoolConfig.push_back({1024 * 16, 500});
m_mempoolConfig.push_back({1024, 5000});
m_mempoolConfig.push_back({1024 * 16, 1000});
m_mempoolConfig.push_back({1024 * 128, 200});
m_mempoolConfig.push_back({1024 * 1024, 50});
m_mempoolConfig.push_back({1024 * 1024 * 2, 20});
m_mempoolConfig.push_back({1024 * 512, 50});
m_mempoolConfig.push_back({1024 * 1024, 30});
m_mempoolConfig.push_back({1024 * 1024 * 4, 10});
m_mempoolConfig.push_back({1024 * 1024 * 8, 10});
m_mempoolConfig.push_back({1024 * 1024 * 16, 10});
m_mempoolConfig.push_back({1024 * 1024 * 32, 5});

return *this;
}
Expand Down
2 changes: 1 addition & 1 deletion iceoryx_posh/test/integrationtests/test_posh_mepoo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ TEST_F(Mepoo_IntegrationTest, MempoolCreationTimeDefaultConfig)
EXPECT_THAT(timediff, Le(maxtime));
}

TEST_F(Mepoo_IntegrationTest, MempoolCreationTime2GBConfig)
TEST_F(Mepoo_IntegrationTest, DISABLED_MempoolCreationTime2GBConfig)
{
constexpr uint32_t chunkSize = 1024 * 1024 * 512;
constexpr uint32_t m_numChunks = 4;
Expand Down
6 changes: 3 additions & 3 deletions iceoryx_posh/test/moduletests/test_posh_senderport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,16 +235,16 @@ TEST_F(SenderPort_test, reserveSample_Overflow)
{
EXPECT_THAT(samples[i], Ne(nullptr));
}
EXPECT_THAT(m_memPoolHandler.getMemPoolInfo(0).m_usedChunks, Eq(16u));
EXPECT_THAT(m_memPoolHandler.getMemPoolInfo(0).m_usedChunks, Eq(iox::MAX_SAMPLE_ALLOCATE_PER_SENDER));

// Allocate one more sample for overflow
#if defined(NDEBUG)
auto sample = m_sender->reserveChunk(sizeof(DummySample));
EXPECT_EQ(sample, nullptr);
EXPECT_THAT(m_memPoolHandler.getMemPoolInfo(0).m_usedChunks, Eq(16u));
EXPECT_THAT(m_memPoolHandler.getMemPoolInfo(0).m_usedChunks, Eq(iox::MAX_SAMPLE_ALLOCATE_PER_SENDER));
#else
ASSERT_DEATH({ m_sender->reserveChunk(sizeof(DummySample)); }, "Application allocates too much chunks");
EXPECT_THAT(m_memPoolHandler.getMemPoolInfo(0).m_usedChunks, Eq(16u));
EXPECT_THAT(m_memPoolHandler.getMemPoolInfo(0).m_usedChunks, Eq(iox::MAX_SAMPLE_ALLOCATE_PER_SENDER));
#endif
}

Expand Down

0 comments on commit 80c5ae5

Please sign in to comment.