memory leaks when use TypeObject for sequences/arrays/maps
Is there an already existing issue for this?
- [X] I have searched the existing issues
Expected behavior
I use the AddressSanitizer tool to detect memory leaks,when sublisher exit,this is report some leaks.
Current behavior
- IDL struct define:
struct data :
{
string name;
short data_array[5];
sequence<short> data_vec;
map<string, unsigned long> data_map;
};
- Publisher code :
registerdataTypes();
type_.get()->auto_fill_type_information(true);
type_.get()->auto_fill_type_object(false);
-
Subscriber code : use
on_type_information_received()receive type and create it. -
FastDDSGen use
-typeobjectgenerate idl.
The communication between the Publisher and the Subscriber is normal. But,Use the AddressSanitizer tool to detect memory leaks,when Subscriber exit ,the following leaks has occurred:
=================================================================
==2176269==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 312 byte(s) in 1 object(s) allocated from:
#0 0x7f2997aa3587 in operator new(unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cc:104
#1 0x7f29974e0211 in void eprosima::fastcdr::deserialize<eprosima::fastrtps::types::PlainSequenceSElemDefn>(eprosima::fastcdr::Cdr&, eprosima::fastrtps::types::PlainSequenceSElemDefn&) (/data/soc-code/code/nos/output/x86_2004/lib/libfastrtps.so.2.12+0x50c211)
Direct leak of 312 byte(s) in 1 object(s) allocated from:
#0 0x7f2997aa3587 in operator new(unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cc:104
#1 0x7f29974e1b91 in void eprosima::fastcdr::deserialize<eprosima::fastrtps::types::PlainMapSTypeDefn>(eprosima::fastcdr::Cdr&, eprosima::fastrtps::types::PlainMapSTypeDefn&) (/data/soc-code/code/nos/output/x86_2004/lib/libfastrtps.so.2.12+0x50db91)
Direct leak of 312 byte(s) in 1 object(s) allocated from:
#0 0x7f2997aa3587 in operator new(unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cc:104
#1 0x7f29974e1bb9 in void eprosima::fastcdr::deserialize<eprosima::fastrtps::types::PlainMapSTypeDefn>(eprosima::fastcdr::Cdr&, eprosima::fastrtps::types::PlainMapSTypeDefn&) (/data/soc-code/code/nos/output/x86_2004/lib/libfastrtps.so.2.12+0x50dbb9)
Direct leak of 312 byte(s) in 1 object(s) allocated from:
#0 0x7f2997aa3587 in operator new(unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cc:104
#1 0x7f29974e2cd8 in void eprosima::fastcdr::deserialize<eprosima::fastrtps::types::PlainArraySElemDefn>(eprosima::fastcdr::Cdr&, eprosima::fastrtps::types::PlainArraySElemDefn&) (/data/soc-code/code/nos/output/x86_2004/lib/libfastrtps.so.2.12+0x50ecd8)
SUMMARY: AddressSanitizer: 1248 byte(s) leaked in 4 allocation(s).
The detailed stack information is as follows:
Steps to reproduce
See Above
Fast DDS version/commit
v2.12.0
Platform/Architecture
Ubuntu Focal 20.04 amd64
Transport layer
Shared Memory Transport (SHM)
Additional context
No response
XML configuration file
No response
Relevant log output
No response
Network traffic capture
No response
Thanks for your report @TechVortexZ
This feature is being currently refactored and it will be available in the next few months. Regretfully, it is not going to be fixed in previous releases. Please, wait until this release in order to use the TypeObject representation with collection types.