diff --git a/src/vt/serialization/messaging/serialized_messenger.impl.h b/src/vt/serialization/messaging/serialized_messenger.impl.h index 250cb4657a..5cd8a56cc6 100644 --- a/src/vt/serialization/messaging/serialized_messenger.impl.h +++ b/src/vt/serialization/messaging/serialized_messenger.impl.h @@ -423,6 +423,8 @@ template auto msg_data = ptr; auto user_msg = deserializeFullMessage(msg_data); + std::free(msg_data); + vt_debug_print( verbose, serial_msg, "serialMsgHandler: local msg: handler={}\n", typed_handler diff --git a/tests/unit/serialization/test_serialize_messenger.cc b/tests/unit/serialization/test_serialize_messenger.cc index c66bff5a1d..df85d7b801 100644 --- a/tests/unit/serialization/test_serialize_messenger.cc +++ b/tests/unit/serialization/test_serialize_messenger.cc @@ -98,6 +98,15 @@ static void myDataMsgHan(MyDataMsg* msg) { msg->check(); } +static void myDataHan(std::vector 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>; }; @@ -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 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();