Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak with version 1.2.11 #302

Open
hlange opened this issue Jul 9, 2019 · 1 comment
Open

Memory leak with version 1.2.11 #302

hlange opened this issue Jul 9, 2019 · 1 comment

Comments

@hlange
Copy link

hlange commented Jul 9, 2019

I am currently developing a client that sends and receives data using UAMQP, but the memory is growing.

Since I work on a Windows system, I studied the program with DrMemory, which tells me the following:

Error #1: LEAK 112 direct bytes + 235 indirect bytes
replace_malloc
d:\drmemory_package\common\alloc_replace.c(2577):
socketio_create
c:\a\azure-iot-sdk-c\c-utility\adapters\socketio_win32.c(157):
xio_create
c:\a\azure-iot-sdk-c\c-utility\src\xio.c(47):
tlsio_schannel_create
c:\a\azure-iot-sdk-c\c-utility\adapters\tlsio_schannel.c(1029):
xio_create
c:\a\azure-iot-sdk-c\c-utility\src\xio.c(47):
UAMQPReceiver::receiveMessages
c:\users\henrik\source\repos\cloudconnector\cloudconnector\classes\uamqp\uamqpreceiver.cpp(121):
std::_Invoker_pmf_pointer::_Call<>
??:0
std::invoke<>
??:0
std::_LaunchPad<>::_Execute<>
??:0
std::_LaunchPad<>::_Run
??:0
std::_LaunchPad<>::_Go
??:0
std::_Pad::_Call_func
??:0

Error #2: LEAK 8 direct bytes + 220 indirect bytes
replace_malloc
d:\drmemory_package\common\alloc_replace.c(2577):
xio_create
c:\a\azure-iot-sdk-c\c-utility\src\xio.c(38):
UAMQPReceiver::receiveMessages
c:\users\henrik\source\repos\cloudconnector\cloudconnector\classes\uamqp\uamqpreceiver.cpp(126):
std::_Invoker_pmf_pointer::_Call<>
??:0
std::invoke<>
??:0
std::_LaunchPad<>::_Execute<>
??:0
std::_LaunchPad<>::_Run
??:0
std::_LaunchPad<>::_Go
??:0
std::_Pad::_Call_func
??:0
ucrtbased.dll!register_onexit_function
??:0
ucrtbased.dll!register_onexit_function
??:0
KERNEL32.dll!BaseThreadInitThunk
??:0

Error #3: LEAK 44 direct bytes + 36 indirect bytes
replace_malloc
d:\drmemory_package\common\alloc_replace.c(2577):
internal_decoder_create
c:\a\azure-iot-sdk-c\uamqp\src\amqpvalue.c(4865):
amqpvalue_decoder_create
c:\a\azure-iot-sdk-c\uamqp\src\amqpvalue.c(6935):
sasl_frame_codec_create
c:\a\azure-iot-sdk-c\uamqp\src\sasl_frame_codec.c(183):
saslclientio_create
c:\a\azure-iot-sdk-c\uamqp\src\saslclientio.c(1002):
xio_create
c:\a\azure-iot-sdk-c\c-utility\src\xio.c(47):
UAMQPReceiver::receiveMessages
c:\users\henrik\source\repos\cloudconnector\cloudconnector\classes\uamqp\uamqpreceiver.cpp(126):
std::_Invoker_pmf_pointer::_Call<>
??:0
std::invoke<>
??:0
std::_LaunchPad<>::_Execute<>
??:0
std::_LaunchPad<>::_Run
??:0
std::_LaunchPad<>::_Go
??:0

Error #4: POSSIBLE LEAK 32 bytes
replace_malloc
d:\drmemory_package\common\alloc_replace.c(2577):
REFCOUNT_AMQP_VALUE_DATA_Create_With_Extra_Size
c:\a\azure-iot-sdk-c\uamqp\src\amqpvalue.c(168):
REFCOUNT_AMQP_VALUE_DATA_Create
c:\a\azure-iot-sdk-c\uamqp\src\amqpvalue.c(168):
amqpvalue_decoder_create
c:\a\azure-iot-sdk-c\uamqp\src\amqpvalue.c(6924):
amqp_frame_codec_create
c:\a\azure-iot-sdk-c\uamqp\src\amqp_frame_codec.c(174):
connection_create2
c:\a\azure-iot-sdk-c\uamqp\src\connection.c(1168):
connection_create
c:\a\azure-iot-sdk-c\uamqp\src\connection.c(1128):
UAMQPSender::sendMessage
c:\users\henrik\source\repos\cloudconnector\cloudconnector\classes\uamqp\uamqpsender.cpp(72):
Sender::processMessage
c:\users\henrik\source\repos\cloudconnector\cloudconnector\classes\cloudcom\sender.cpp(22):
std::_Invoker_pmf_pointer::_Call<>
??:0
std::invoke<>
??:0
std::_LaunchPad<>::_Execute<>
??:0

Error #5: POSSIBLE LEAK 32 bytes
replace_malloc
d:\drmemory_package\common\alloc_replace.c(2577):
REFCOUNT_AMQP_VALUE_DATA_Create_With_Extra_Size
c:\a\azure-iot-sdk-c\uamqp\src\amqpvalue.c(168):
REFCOUNT_AMQP_VALUE_DATA_Create
c:\a\azure-iot-sdk-c\uamqp\src\amqpvalue.c(168):
amqpvalue_create_composite_with_ulong_descriptor
c:\a\azure-iot-sdk-c\uamqp\src\amqpvalue.c(7122):
target_create
c:\a\azure-iot-sdk-c\uamqp\src\amqp_definitions.c(13430):
messaging_create_target
c:\a\azure-iot-sdk-c\uamqp\src\messaging.c(61):
UAMQPSender::sendMessage
c:\users\henrik\source\repos\cloudconnector\cloudconnector\classes\uamqp\uamqpsender.cpp(83):
Sender::processMessage
c:\users\henrik\source\repos\cloudconnector\cloudconnector\classes\cloudcom\sender.cpp(22):
std::_Invoker_pmf_pointer::_Call<>
??:0
std::invoke<>
??:0
std::_LaunchPad<>::_Execute<>
??:0
std::_LaunchPad<>::_Run
??:0

Error #6: POSSIBLE LEAK 32 bytes
replace_malloc
d:\drmemory_package\common\alloc_replace.c(2577):
REFCOUNT_AMQP_VALUE_DATA_Create_With_Extra_Size
c:\a\azure-iot-sdk-c\uamqp\src\amqpvalue.c(168):
REFCOUNT_AMQP_VALUE_DATA_Create
c:\a\azure-iot-sdk-c\uamqp\src\amqpvalue.c(168):
internal_decoder_decode_bytes
c:\a\azure-iot-sdk-c\uamqp\src\amqpvalue.c(6346):
internal_decoder_decode_bytes
c:\a\azure-iot-sdk-c\uamqp\src\amqpvalue.c(5448):
amqpvalue_decode_bytes
c:\a\azure-iot-sdk-c\uamqp\src\amqpvalue.c(6990):
frame_received
c:\a\azure-iot-sdk-c\uamqp\src\sasl_frame_codec.c(112):
frame_codec_receive_bytes
c:\a\azure-iot-sdk-c\uamqp\src\frame_codec.c(408):
saslclientio_receive_byte
c:\a\azure-iot-sdk-c\uamqp\src\saslclientio.c(367):
on_underlying_io_bytes_received
c:\a\azure-iot-sdk-c\uamqp\src\saslclientio.c(478):
on_underlying_io_bytes_received
c:\a\azure-iot-sdk-c\c-utility\adapters\tlsio_schannel.c(807):
socketio_dowork
c:\a\azure-iot-sdk-c\c-utility\adapters\socketio_win32.c(521):

Error #7: POSSIBLE LEAK 32 bytes
replace_malloc
d:\drmemory_package\common\alloc_replace.c(2577):
REFCOUNT_AMQP_VALUE_DATA_Create_With_Extra_Size
c:\a\azure-iot-sdk-c\uamqp\src\amqpvalue.c(168):
REFCOUNT_AMQP_VALUE_DATA_Create
c:\a\azure-iot-sdk-c\uamqp\src\amqpvalue.c(168):
internal_decoder_decode_bytes
c:\a\azure-iot-sdk-c\uamqp\src\amqpvalue.c(4936):
amqpvalue_decode_bytes
c:\a\azure-iot-sdk-c\uamqp\src\amqpvalue.c(6990):
frame_received
c:\a\azure-iot-sdk-c\uamqp\src\sasl_frame_codec.c(112):
frame_codec_receive_bytes
c:\a\azure-iot-sdk-c\uamqp\src\frame_codec.c(408):
saslclientio_receive_byte
c:\a\azure-iot-sdk-c\uamqp\src\saslclientio.c(367):
on_underlying_io_bytes_received
c:\a\azure-iot-sdk-c\uamqp\src\saslclientio.c(478):
on_underlying_io_bytes_received
c:\a\azure-iot-sdk-c\c-utility\adapters\tlsio_schannel.c(807):
socketio_dowork
c:\a\azure-iot-sdk-c\c-utility\adapters\socketio_win32.c(521):
xio_dowork
c:\a\azure-iot-sdk-c\c-utility\src\xio.c(165):

Error #8: POSSIBLE LEAK 32 bytes
replace_malloc
d:\drmemory_package\common\alloc_replace.c(2577):
REFCOUNT_AMQP_VALUE_DATA_Create_With_Extra_Size
c:\a\azure-iot-sdk-c\uamqp\src\amqpvalue.c(168):
REFCOUNT_AMQP_VALUE_DATA_Create
c:\a\azure-iot-sdk-c\uamqp\src\amqpvalue.c(168):
internal_decoder_decode_bytes
c:\a\azure-iot-sdk-c\uamqp\src\amqpvalue.c(4962):
amqpvalue_decode_bytes
c:\a\azure-iot-sdk-c\uamqp\src\amqpvalue.c(6990):
frame_received
c:\a\azure-iot-sdk-c\uamqp\src\sasl_frame_codec.c(112):
frame_codec_receive_bytes
c:\a\azure-iot-sdk-c\uamqp\src\frame_codec.c(408):
saslclientio_receive_byte
c:\a\azure-iot-sdk-c\uamqp\src\saslclientio.c(367):
on_underlying_io_bytes_received
c:\a\azure-iot-sdk-c\uamqp\src\saslclientio.c(478):
on_underlying_io_bytes_received
c:\a\azure-iot-sdk-c\c-utility\adapters\tlsio_schannel.c(807):
socketio_dowork
c:\a\azure-iot-sdk-c\c-utility\adapters\socketio_win32.c(521):
xio_dowork
c:\a\azure-iot-sdk-c\c-utility\src\xio.c(165):

Error #9: POSSIBLE LEAK 32 direct bytes + 8 indirect bytes
replace_malloc
d:\drmemory_package\common\alloc_replace.c(2577):
REFCOUNT_AMQP_VALUE_DATA_Create_With_Extra_Size
c:\a\azure-iot-sdk-c\uamqp\src\amqpvalue.c(168):
REFCOUNT_AMQP_VALUE_DATA_Create
c:\a\azure-iot-sdk-c\uamqp\src\amqpvalue.c(168):
internal_decoder_decode_bytes
c:\a\azure-iot-sdk-c\uamqp\src\amqpvalue.c(5413):
amqpvalue_decode_bytes
c:\a\azure-iot-sdk-c\uamqp\src\amqpvalue.c(6990):
frame_received
c:\a\azure-iot-sdk-c\uamqp\src\sasl_frame_codec.c(112):
frame_codec_receive_bytes
c:\a\azure-iot-sdk-c\uamqp\src\frame_codec.c(408):
saslclientio_receive_byte
c:\a\azure-iot-sdk-c\uamqp\src\saslclientio.c(367):
on_underlying_io_bytes_received
c:\a\azure-iot-sdk-c\uamqp\src\saslclientio.c(478):
on_underlying_io_bytes_received
c:\a\azure-iot-sdk-c\c-utility\adapters\tlsio_schannel.c(807):
socketio_dowork
c:\a\azure-iot-sdk-c\c-utility\adapters\socketio_win32.c(521):
xio_dowork
c:\a\azure-iot-sdk-c\c-utility\src\xio.c(165):

Error #10: POSSIBLE LEAK 32 direct bytes + 32 indirect bytes
replace_malloc
d:\drmemory_package\common\alloc_replace.c(2577):
REFCOUNT_AMQP_VALUE_DATA_Create_With_Extra_Size
c:\a\azure-iot-sdk-c\uamqp\src\amqpvalue.c(168):
REFCOUNT_AMQP_VALUE_DATA_Create
c:\a\azure-iot-sdk-c\uamqp\src\amqpvalue.c(168):
amqpvalue_create_composite_with_ulong_descriptor
c:\a\azure-iot-sdk-c\uamqp\src\amqpvalue.c(7122):
source_create
c:\a\azure-iot-sdk-c\uamqp\src\amqp_definitions.c(11918):
messaging_create_source
c:\a\azure-iot-sdk-c\uamqp\src\messaging.c(14):
UAMQPSender::sendMessage
c:\users\henrik\source\repos\cloudconnector\cloudconnector\classes\uamqp\uamqpsender.cpp(80):
Sender::processMessage
c:\users\henrik\source\repos\cloudconnector\cloudconnector\classes\cloudcom\sender.cpp(22):
std::_Invoker_pmf_pointer::_Call<>
??:0
std::invoke<>
??:0
std::_LaunchPad<>::_Execute<>
??:0
std::_LaunchPad<>::_Run
??:0

Error #11: POSSIBLE LEAK 32 bytes
replace_malloc
d:\drmemory_package\common\alloc_replace.c(2577):
REFCOUNT_AMQP_VALUE_DATA_Create_With_Extra_Size
c:\a\azure-iot-sdk-c\uamqp\src\amqpvalue.c(168):
REFCOUNT_AMQP_VALUE_DATA_Create
c:\a\azure-iot-sdk-c\uamqp\src\amqpvalue.c(168):
amqpvalue_decoder_create
c:\a\azure-iot-sdk-c\uamqp\src\amqpvalue.c(6924):
sasl_frame_codec_create
c:\a\azure-iot-sdk-c\uamqp\src\sasl_frame_codec.c(183):
saslclientio_create
c:\a\azure-iot-sdk-c\uamqp\src\saslclientio.c(1002):
xio_create
c:\a\azure-iot-sdk-c\c-utility\src\xio.c(47):
UAMQPSender::sendMessage
c:\users\henrik\source\repos\cloudconnector\cloudconnector\classes\uamqp\uamqpsender.cpp(69):
Sender::processMessage
c:\users\henrik\source\repos\cloudconnector\cloudconnector\classes\cloudcom\sender.cpp(22):
std::_Invoker_pmf_pointer::_Call<>
??:0
std::invoke<>
??:0
std::_LaunchPad<>::_Execute<>
??:0

Error #12: POSSIBLE LEAK 32 direct bytes + 4 indirect bytes
replace_malloc
d:\drmemory_package\common\alloc_replace.c(2577):
REFCOUNT_AMQP_VALUE_DATA_Create_With_Extra_Size
c:\a\azure-iot-sdk-c\uamqp\src\amqpvalue.c(168):
REFCOUNT_AMQP_VALUE_DATA_Create
c:\a\azure-iot-sdk-c\uamqp\src\amqpvalue.c(168):
amqpvalue_create_list
c:\a\azure-iot-sdk-c\uamqp\src\amqpvalue.c(1219):
amqpvalue_create_composite_with_ulong_descriptor
c:\a\azure-iot-sdk-c\uamqp\src\amqpvalue.c(7140):
target_create
c:\a\azure-iot-sdk-c\uamqp\src\amqp_definitions.c(13430):
messaging_create_target
c:\a\azure-iot-sdk-c\uamqp\src\messaging.c(61):
UAMQPSender::sendMessage
c:\users\henrik\source\repos\cloudconnector\cloudconnector\classes\uamqp\uamqpsender.cpp(83):
Sender::processMessage
c:\users\henrik\source\repos\cloudconnector\cloudconnector\classes\cloudcom\sender.cpp(22):
std::_Invoker_pmf_pointer::_Call<>
??:0
std::invoke<>
??:0
std::_LaunchPad<>::_Execute<>
??:0

Error #13: POSSIBLE LEAK 32 direct bytes + 111 indirect bytes
replace_malloc
d:\drmemory_package\common\alloc_replace.c(2577):
REFCOUNT_AMQP_VALUE_DATA_Create_With_Extra_Size
c:\a\azure-iot-sdk-c\uamqp\src\amqpvalue.c(168):
REFCOUNT_AMQP_VALUE_DATA_Create
c:\a\azure-iot-sdk-c\uamqp\src\amqpvalue.c(168):
amqpvalue_create_string
c:\a\azure-iot-sdk-c\uamqp\src\amqpvalue.c(1069):
messaging_create_target
c:\a\azure-iot-sdk-c\uamqp\src\messaging.c(70):
UAMQPSender::sendMessage
c:\users\henrik\source\repos\cloudconnector\cloudconnector\classes\uamqp\uamqpsender.cpp(83):
Sender::processMessage
c:\users\henrik\source\repos\cloudconnector\cloudconnector\classes\cloudcom\sender.cpp(22):
std::_Invoker_pmf_pointer::_Call<>
??:0
std::invoke<>
??:0
std::_LaunchPad<>::_Execute<>
??:0
std::_LaunchPad<>::_Run
??:0
std::_LaunchPad<>::_Go
??:0

Error #14: POSSIBLE LEAK 32 bytes
replace_malloc
d:\drmemory_package\common\alloc_replace.c(2577):
REFCOUNT_AMQP_VALUE_DATA_Create_With_Extra_Size
c:\a\azure-iot-sdk-c\uamqp\src\amqpvalue.c(168):
REFCOUNT_AMQP_VALUE_DATA_Create
c:\a\azure-iot-sdk-c\uamqp\src\amqpvalue.c(168):
amqpvalue_create_ulong
c:\a\azure-iot-sdk-c\uamqp\src\amqpvalue.c(430):
amqpvalue_create_composite_with_ulong_descriptor
c:\a\azure-iot-sdk-c\uamqp\src\amqpvalue.c(7129):
target_create
c:\a\azure-iot-sdk-c\uamqp\src\amqp_definitions.c(13430):
messaging_create_target
c:\a\azure-iot-sdk-c\uamqp\src\messaging.c(61):
UAMQPSender::sendMessage
c:\users\henrik\source\repos\cloudconnector\cloudconnector\classes\uamqp\uamqpsender.cpp(83):
Sender::processMessage
c:\users\henrik\source\repos\cloudconnector\cloudconnector\classes\cloudcom\sender.cpp(22):
std::_Invoker_pmf_pointer::_Call<>
??:0
std::invoke<>
??:0
std::_LaunchPad<>::_Execute<>
??:0

Error #15: POSSIBLE LEAK 32 direct bytes + 4 indirect bytes
replace_malloc
d:\drmemory_package\common\alloc_replace.c(2577):
REFCOUNT_AMQP_VALUE_DATA_Create_With_Extra_Size
c:\a\azure-iot-sdk-c\uamqp\src\amqpvalue.c(168):
REFCOUNT_AMQP_VALUE_DATA_Create
c:\a\azure-iot-sdk-c\uamqp\src\amqpvalue.c(168):
amqpvalue_create_list
c:\a\azure-iot-sdk-c\uamqp\src\amqpvalue.c(1219):
amqpvalue_create_composite_with_ulong_descriptor
c:\a\azure-iot-sdk-c\uamqp\src\amqpvalue.c(7140):
source_create
c:\a\azure-iot-sdk-c\uamqp\src\amqp_definitions.c(11918):
messaging_create_source
c:\a\azure-iot-sdk-c\uamqp\src\messaging.c(14):
UAMQPSender::sendMessage
c:\users\henrik\source\repos\cloudconnector\cloudconnector\classes\uamqp\uamqpsender.cpp(80):
Sender::processMessage
c:\users\henrik\source\repos\cloudconnector\cloudconnector\classes\cloudcom\sender.cpp(22):
std::_Invoker_pmf_pointer::_Call<>
??:0
std::invoke<>
??:0
std::_LaunchPad<>::_Execute<>
??:0

Error #16: POSSIBLE LEAK 32 direct bytes + 9 indirect bytes
replace_malloc
d:\drmemory_package\common\alloc_replace.c(2577):
REFCOUNT_AMQP_VALUE_DATA_Create_With_Extra_Size
c:\a\azure-iot-sdk-c\uamqp\src\amqpvalue.c(168):
REFCOUNT_AMQP_VALUE_DATA_Create
c:\a\azure-iot-sdk-c\uamqp\src\amqpvalue.c(168):
amqpvalue_create_string
c:\a\azure-iot-sdk-c\uamqp\src\amqpvalue.c(1069):
messaging_create_source
c:\a\azure-iot-sdk-c\uamqp\src\messaging.c(23):
UAMQPSender::sendMessage
c:\users\henrik\source\repos\cloudconnector\cloudconnector\classes\uamqp\uamqpsender.cpp(80):
Sender::processMessage
c:\users\henrik\source\repos\cloudconnector\cloudconnector\classes\cloudcom\sender.cpp(22):
std::_Invoker_pmf_pointer::_Call<>
??:0
std::invoke<>
??:0
std::_LaunchPad<>::_Execute<>
??:0
std::_LaunchPad<>::_Run
??:0
std::_LaunchPad<>::_Go
??:0

Reached maximum leak report limit (-report_leak_max). No further leaks will be reported.

===========================================================================
FINAL SUMMARY:

DUPLICATE ERROR COUNTS:
Error # 6: 2

SUPPRESSIONS USED:

ERRORS FOUND:
0 unique, 0 total unaddressable access(es)
0 unique, 0 total uninitialized access(es)
0 unique, 0 total invalid heap argument(s)
0 unique, 0 total GDI usage error(s)
0 unique, 0 total handle leak(s)
0 unique, 0 total warning(s)
3 unique, 3 total, 655 byte(s) of leak(s)
13 unique, 14 total, 624 byte(s) of possible leak(s)
20162 leak(s) beyond -report_leak_max

@hlange
Copy link
Author

hlange commented Jul 9, 2019

c:\users\henrik\source\repos\cloudconnector\cloudconnector\classes\uamqp\uamqpreceiver.cpp(121):
tls_io = xio_create(tlsio_interface, &tls_io_config);
c:\users\henrik\source\repos\cloudconnector\cloudconnector\classes\uamqp\uamqpreceiver.cpp(126):
sasl_io = xio_create(saslclientio_get_interface_description(), &sasl_io_config);
c:\users\henrik\source\repos\cloudconnector\cloudconnector\classes\uamqp\uamqpsender.cpp(80):
source = messaging_create_source("whatever");
c:\users\henrik\source\repos\cloudconnector\cloudconnector\classes\uamqp\uamqpsender.cpp(83):
target = messaging_create_target(adress.c_str());
c:\users\henrik\source\repos\cloudconnector\cloudconnector\classes\cloudcom\sender.cpp(22):

unique_ptr<UAMQPSender> sender = make_unique<UAMQPSender>();
log4cpp::Category::getInstance(std::string("MSG")).debug("Send: " + msg.dump());
sender->sendMessage(msg);

c:\users\henrik\source\repos\cloudconnector\cloudconnector\classes\uamqp\uamqpsender.cpp(69):
sasl_io = xio_create(saslclientio_get_interface_description(), &sasl_io_config);

Receiver and sender are based on the examples https://github.com/Azure/azure-uamqp-c/blob/master/samples/message_receiver_sample/main.c and https://github.com/Azure/azure-uamqp-c/blob/master/samples/message_sender_sample/main.c, and were only transformed to a class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant