Skip to content

Commit

Permalink
Merge pull request #2274 from DARMA-tasking/2273-memory-leak-in-seria…
Browse files Browse the repository at this point in the history
…lized-messenger-for-local-sends

#2273: serialization: fix memory leak in local send
  • Loading branch information
lifflander authored Apr 29, 2024
2 parents ae7478d + fe6f637 commit 86a399f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/vt/serialization/messaging/serialized_messenger.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,8 @@ template <typename MsgT, typename BaseT>
auto msg_data = ptr;
auto user_msg = deserializeFullMessage<MsgT>(msg_data);

std::free(msg_data);

vt_debug_print(
verbose, serial_msg,
"serialMsgHandler: local msg: handler={}\n", typed_handler
Expand Down
18 changes: 18 additions & 0 deletions tests/unit/serialization/test_serialize_messenger.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,15 @@ static void myDataMsgHan(MyDataMsg* msg) {
msg->check();
}

static void myDataHan(std::vector<int> const& vec) {
int i = 0;
EXPECT_EQ(vec.size(), 100ull);
for (auto&& x : vec) {
EXPECT_EQ(x, i);
i++;
}
}

struct TestSerialMessenger : TestParallelHarness {
using TestMsg = TestStaticBytesShortMsg<4>;
};
Expand All @@ -115,6 +124,15 @@ TEST_F(TestSerialMessenger, test_serial_messenger_1) {
}
}

TEST_F(TestSerialMessenger, test_serial_messenger_2) {
auto const& this_node = theContext()->getNode();
std::vector<int> vec;
for (int i = 0; i < 100; i++) {
vec.push_back(i);
}
theMsg()->send<&myDataHan>(vt::Node(this_node), vec);
}

TEST_F(TestSerialMessenger, test_serial_messenger_bcast_1) {
auto const& my_node = theContext()->getNode();

Expand Down

0 comments on commit 86a399f

Please sign in to comment.