Closed nqf closed 4 months ago
Drogon is having problems exiting correctly now. The lost memories should be because of that. We will work on it. Thanks very much for your report.
Should be ok after #1250. Could you test it on your machine?
@hwc0919 use drogon v1.8.0 still have a memory leak, maybe need call mysql_library_end();
in drogon
==13766== Memcheck, a memory error detector
==13766== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==13766== Using Valgrind-3.17.0 and LibVEX; rerun with -h for copyright info
==13766== Command: ./test-db -f ../cfg/test-db.yaml -D
==13766== Parent PID: 40502
==13766==
==13766== Warning: client switching stacks? SP change: 0x7a47a08 --> 0x5fcd9d0
==13766== to suppress, use: --max-stackframe=27762744 or greater
==13766== Warning: client switching stacks? SP change: 0xea55a08 --> 0x609b050
==13766== to suppress, use: --max-stackframe=144419256 or greater
==13766== Warning: client switching stacks? SP change: 0x7a46a58 --> 0x5fcd510
==13766== to suppress, use: --max-stackframe=27759944 or greater
==13766== further instances of this message will not be shown.
==13766==
==13766== HEAP SUMMARY:
==13766== in use at exit: 81,328 bytes in 37 blocks
==13766== total heap usage: 17,454 allocs, 17,417 frees, 2,722,873 bytes allocated
==13766==
==13766== 24 bytes in 1 blocks are still reachable in loss record 1 of 6
==13766== at 0x4C2B067: malloc (vg_replace_malloc.c:380)
==13766== by 0x966F84: my_malloc (my_malloc.c:41)
==13766== by 0x95FC03: my_error_register (my_error.c:196)
==13766== by 0x950F24: mysql_server_init (libmysql.c:134)
==13766== by 0x947286: mysql_init (client.c:1736)
==13766== by 0x518C17: drogon::orm::MysqlConnection::MysqlConnection(trantor::EventLoop*, std::string const&) (in /home/fantasy/test-db/build/test-db)
==13766== by 0x4BBD56: void __gnu_cxx::new_allocator<drogon::orm::MysqlConnection>::construct<drogon::orm::MysqlConnection, trantor::EventLoop*&, std::string&>(drogon::orm::MysqlConnection*, trantor::EventLoop*&, std::string&) (in /home/fantasy/test-db/build/test-db)
==13766== by 0x4BAC6B: void std::allocator_traits<std::allocator<drogon::orm::MysqlConnection> >::construct<drogon::orm::MysqlConnection, trantor::EventLoop*&, std::string&>(std::allocator<drogon::orm::MysqlConnection>&, drogon::orm::MysqlConnection*, trantor::EventLoop*&, std::string&) (in /home/fantasy/test-db/build/test-db)
==13766== by 0x4B9621: std::_Sp_counted_ptr_inplace<drogon::orm::MysqlConnection, std::allocator<drogon::orm::MysqlConnection>, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<trantor::EventLoop*&, std::string&>(std::allocator<drogon::orm::MysqlConnection>, trantor::EventLoop*&, std::string&) (in /home/fantasy/test-db/build/test-db)
==13766== by 0x4B7C58: std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<drogon::orm::MysqlConnection, std::allocator<drogon::orm::MysqlConnection>, trantor::EventLoop*&, std::string&>(drogon::orm::MysqlConnection*&, std::_Sp_alloc_shared_tag<std::allocator<drogon::orm::MysqlConnection> >, trantor::EventLoop*&, std::string&) (in /home/fantasy/test-db/build/test-db)
==13766== by 0x4B60F9: std::__shared_ptr<drogon::orm::MysqlConnection, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<drogon::orm::MysqlConnection>, trantor::EventLoop*&, std::string&>(std::_Sp_alloc_shared_tag<std::allocator<drogon::orm::MysqlConnection> >, trantor::EventLoop*&, std::string&) (in /home/fantasy/test-db/build/test-db)
==13766== by 0x4B44CE: std::shared_ptr<drogon::orm::MysqlConnection>::shared_ptr<std::allocator<drogon::orm::MysqlConnection>, trantor::EventLoop*&, std::string&>(std::_Sp_alloc_shared_tag<std::allocator<drogon::orm::MysqlConnection> >, trantor::EventLoop*&, std::string&) (in /home/fantasy/test-db/build/test-db)
==13766==
==13766== 152 bytes in 1 blocks are still reachable in loss record 2 of 6
==13766== at 0x4C2B067: malloc (vg_replace_malloc.c:380)
==13766== by 0x966F84: my_malloc (my_malloc.c:41)
==13766== by 0x96C26D: init_alloc_root (my_alloc.c:63)
==13766== by 0x9ABE9D: mysql_client_plugin_init (client_plugin.c:254)
==13766== by 0x950F2B: mysql_server_init (libmysql.c:135)
==13766== by 0x947286: mysql_init (client.c:1736)
==13766== by 0x518C17: drogon::orm::MysqlConnection::MysqlConnection(trantor::EventLoop*, std::string const&) (in /home/fantasy/test-db/build/test-db)
==13766== by 0x4BBD56: void __gnu_cxx::new_allocator<drogon::orm::MysqlConnection>::construct<drogon::orm::MysqlConnection, trantor::EventLoop*&, std::string&>(drogon::orm::MysqlConnection*, trantor::EventLoop*&, std::string&) (in /home/fantasy/test-db/build/test-db)
==13766== by 0x4BAC6B: void std::allocator_traits<std::allocator<drogon::orm::MysqlConnection> >::construct<drogon::orm::MysqlConnection, trantor::EventLoop*&, std::string&>(std::allocator<drogon::orm::MysqlConnection>&, drogon::orm::MysqlConnection*, trantor::EventLoop*&, std::string&) (in /home/fantasy/test-db/build/test-db)
==13766== by 0x4B9621: std::_Sp_counted_ptr_inplace<drogon::orm::MysqlConnection, std::allocator<drogon::orm::MysqlConnection>, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<trantor::EventLoop*&, std::string&>(std::allocator<drogon::orm::MysqlConnection>, trantor::EventLoop*&, std::string&) (in /home/fantasy/test-db/build/test-db)
==13766== by 0x4B7C58: std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<drogon::orm::MysqlConnection, std::allocator<drogon::orm::MysqlConnection>, trantor::EventLoop*&, std::string&>(drogon::orm::MysqlConnection*&, std::_Sp_alloc_shared_tag<std::allocator<drogon::orm::MysqlConnection> >, trantor::EventLoop*&, std::string&) (in /home/fantasy/test-db/build/test-db)
==13766== by 0x4B60F9: std::__shared_ptr<drogon::orm::MysqlConnection, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<drogon::orm::MysqlConnection>, trantor::EventLoop*&, std::string&>(std::_Sp_alloc_shared_tag<std::allocator<drogon::orm::MysqlConnection> >, trantor::EventLoop*&, std::string&) (in /home/fantasy/test-db/build/test-db)
==13766==
==13766== 208 bytes in 1 blocks are definitely lost in loss record 3 of 6
==13766== at 0x4C2F7C8: calloc (vg_replace_malloc.c:1117)
==13766== by 0x96D27E: my_thread_init (my_thr_init.c:340)
==13766== by 0x96D456: my_thread_global_init (my_thr_init.c:208)
==13766== by 0x9628DE: my_init (my_init.c:104)
==13766== by 0x950EFB: mysql_server_init (libmysql.c:132)
==13766== by 0x947286: mysql_init (client.c:1736)
==13766== by 0x518C17: drogon::orm::MysqlConnection::MysqlConnection(trantor::EventLoop*, std::string const&) (in /home/fantasy/test-db/build/test-db)
==13766== by 0x4BBD56: void __gnu_cxx::new_allocator<drogon::orm::MysqlConnection>::construct<drogon::orm::MysqlConnection, trantor::EventLoop*&, std::string&>(drogon::orm::MysqlConnection*, trantor::EventLoop*&, std::string&) (in /home/fantasy/test-db/build/test-db)
==13766== by 0x4BAC6B: void std::allocator_traits<std::allocator<drogon::orm::MysqlConnection> >::construct<drogon::orm::MysqlConnection, trantor::EventLoop*&, std::string&>(std::allocator<drogon::orm::MysqlConnection>&, drogon::orm::MysqlConnection*, trantor::EventLoop*&, std::string&) (in /home/fantasy/test-db/build/test-db)
==13766== by 0x4B9621: std::_Sp_counted_ptr_inplace<drogon::orm::MysqlConnection, std::allocator<drogon::orm::MysqlConnection>, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<trantor::EventLoop*&, std::string&>(std::allocator<drogon::orm::MysqlConnection>, trantor::EventLoop*&, std::string&) (in /home/fantasy/test-db/build/test-db)
==13766== by 0x4B7C58: std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<drogon::orm::MysqlConnection, std::allocator<drogon::orm::MysqlConnection>, trantor::EventLoop*&, std::string&>(drogon::orm::MysqlConnection*&, std::_Sp_alloc_shared_tag<std::allocator<drogon::orm::MysqlConnection> >, trantor::EventLoop*&, std::string&) (in /home/fantasy/test-db/build/test-db)
==13766== by 0x4B60F9: std::__shared_ptr<drogon::orm::MysqlConnection, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<drogon::orm::MysqlConnection>, trantor::EventLoop*&, std::string&>(std::_Sp_alloc_shared_tag<std::allocator<drogon::orm::MysqlConnection> >, trantor::EventLoop*&, std::string&) (in /home/fantasy/test-db/build/test-db)
==13766==
==13766== 3,120 bytes in 15 blocks are definitely lost in loss record 4 of 6
==13766== at 0x4C2F7C8: calloc (vg_replace_malloc.c:1117)
==13766== by 0x96D27E: my_thread_init (my_thr_init.c:340)
==13766== by 0x950F14: mysql_server_init (libmysql.c:183)
==13766== by 0x947286: mysql_init (client.c:1736)
==13766== by 0x518C17: drogon::orm::MysqlConnection::MysqlConnection(trantor::EventLoop*, std::string const&) (in /home/fantasy/test-db/build/test-db)
==13766== by 0x4BBD56: void __gnu_cxx::new_allocator<drogon::orm::MysqlConnection>::construct<drogon::orm::MysqlConnection, trantor::EventLoop*&, std::string&>(drogon::orm::MysqlConnection*, trantor::EventLoop*&, std::string&) (in /home/fantasy/test-db/build/test-db)
==13766== by 0x4BAC6B: void std::allocator_traits<std::allocator<drogon::orm::MysqlConnection> >::construct<drogon::orm::MysqlConnection, trantor::EventLoop*&, std::string&>(std::allocator<drogon::orm::MysqlConnection>&, drogon::orm::MysqlConnection*, trantor::EventLoop*&, std::string&) (in /home/fantasy/test-db/build/test-db)
==13766== by 0x4B9621: std::_Sp_counted_ptr_inplace<drogon::orm::MysqlConnection, std::allocator<drogon::orm::MysqlConnection>, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<trantor::EventLoop*&, std::string&>(std::allocator<drogon::orm::MysqlConnection>, trantor::EventLoop*&, std::string&) (in /home/fantasy/test-db/build/test-db)
==13766== by 0x4B7C58: std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<drogon::orm::MysqlConnection, std::allocator<drogon::orm::MysqlConnection>, trantor::EventLoop*&, std::string&>(drogon::orm::MysqlConnection*&, std::_Sp_alloc_shared_tag<std::allocator<drogon::orm::MysqlConnection> >, trantor::EventLoop*&, std::string&) (in /home/fantasy/test-db/build/test-db)
==13766== by 0x4B60F9: std::__shared_ptr<drogon::orm::MysqlConnection, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<drogon::orm::MysqlConnection>, trantor::EventLoop*&, std::string&>(std::_Sp_alloc_shared_tag<std::allocator<drogon::orm::MysqlConnection> >, trantor::EventLoop*&, std::string&) (in /home/fantasy/test-db/build/test-db)
==13766== by 0x4B44CE: std::shared_ptr<drogon::orm::MysqlConnection>::shared_ptr<std::allocator<drogon::orm::MysqlConnection>, trantor::EventLoop*&, std::string&>(std::_Sp_alloc_shared_tag<std::allocator<drogon::orm::MysqlConnection> >, trantor::EventLoop*&, std::string&) (in /home/fantasy/test-db/build/test-db)
==13766== by 0x4B1E4E: std::shared_ptr<drogon::orm::MysqlConnection> std::allocate_shared<drogon::orm::MysqlConnection, std::allocator<drogon::orm::MysqlConnection>, trantor::EventLoop*&, std::string&>(std::allocator<drogon::orm::MysqlConnection> const&, trantor::EventLoop*&, std::string&) (in /home/fantasy/test-db/build/test-db)
==13766==
==13766== 36,864 bytes in 9 blocks are still reachable in loss record 5 of 6
==13766== at 0x4C2B067: malloc (vg_replace_malloc.c:380)
==13766== by 0x9C5495: my_once_alloc (my_once.c:58)
==13766== by 0x964201: init_state_maps (charset.c:66)
==13766== by 0x96503B: init_available_charsets (charset.c:455)
==13766== by 0x4E47E6F: pthread_once (in /usr/lib64/libpthread-2.17.so)
==13766== by 0x96590D: get_charset_by_csname (charset.c:647)
==13766== by 0x947597: mysql_set_character_set_with_default_collation (client.c:2289)
==13766== by 0x947597: mysql_init_character_set (client.c:2328)
==13766== by 0x948496: mysql_real_connect (client.c:3465)
==13766== by 0x94A6E3: mysql_real_connect_start_internal (mysql_async.c:411)
==13766== by 0x96BF54: my_context_spawn (my_context.c:205)
==13766==
==13766== 40,960 bytes in 10 blocks are still reachable in loss record 6 of 6
==13766== at 0x4C2B067: malloc (vg_replace_malloc.c:380)
==13766== by 0x9C5495: my_once_alloc (my_once.c:58)
==13766== by 0x9641E2: init_state_maps (charset.c:63)
==13766== by 0x96503B: init_available_charsets (charset.c:455)
==13766== by 0x4E47E6F: pthread_once (in /usr/lib64/libpthread-2.17.so)
==13766== by 0x96590D: get_charset_by_csname (charset.c:647)
==13766== by 0x947597: mysql_set_character_set_with_default_collation (client.c:2289)
==13766== by 0x947597: mysql_init_character_set (client.c:2328)
==13766== by 0x948496: mysql_real_connect (client.c:3465)
==13766== by 0x94A6E3: mysql_real_connect_start_internal (mysql_async.c:411)
==13766== by 0x96BF54: my_context_spawn (my_context.c:205)
==13766==
==13766== LEAK SUMMARY:
==13766== definitely lost: 3,328 bytes in 16 blocks
==13766== indirectly lost: 0 bytes in 0 blocks
==13766== possibly lost: 0 bytes in 0 blocks
==13766== still reachable: 78,000 bytes in 21 blocks
==13766== suppressed: 0 bytes in 0 blocks
==13766==
==13766== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)
I called mysql_library_end
in my application, but this error occurred
Error in my_thread_global_end(): 16 threads didn't exit
it seem that also need call mysql_thread_end
@nqf Please check #1387 out, thanks.
==11618== Memcheck, a memory error detector
==11618== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==11618== Using Valgrind-3.17.0 and LibVEX; rerun with -h for copyright info
==11618== Command: ./test -f ../cfg/test.yaml -D
==11618== Parent PID: 40502
==11618==
==11618== Warning: client switching stacks? SP change: 0x8a49a08 --> 0x5fde030
==11618== to suppress, use: --max-stackframe=44480984 or greater
==11618== Warning: client switching stacks? SP change: 0x8a48a58 --> 0x5fddb70
==11618== to suppress, use: --max-stackframe=44478184 or greater
==11618== Warning: client switching stacks? SP change: 0x7a47a08 --> 0x5fcada0
==11618== to suppress, use: --max-stackframe=27774056 or greater
==11618== further instances of this message will not be shown.
==11618==
==11618== HEAP SUMMARY:
==11618== in use at exit: 3,328 bytes in 16 blocks
==11618== total heap usage: 17,489 allocs, 17,473 frees, 2,735,978 bytes allocated
==11618==
==11618== 208 bytes in 1 blocks are definitely lost in loss record 1 of 2
==11618== at 0x4C2F7C8: calloc (vg_replace_malloc.c:1117)
==11618== by 0x96D62E: my_thread_init (my_thr_init.c:340)
==11618== by 0x96D806: my_thread_global_init (my_thr_init.c:208)
==11618== by 0x962B4E: my_init (my_init.c:104)
==11618== by 0x95115B: mysql_server_init (libmysql.c:132)
==11618== by 0x9474C6: mysql_init (client.c:1766)
==11618== by 0x518CCF: drogon::orm::MysqlConnection::MysqlConnection(trantor::EventLoop*, std::string const&) (in /home/fantasy/test/build/test)
==11618== by 0x4BBD56: void __gnu_cxx::new_allocator<drogon::orm::MysqlConnection>::construct<drogon::orm::MysqlConnection, trantor::EventLoop*&, std::string&>(drogon::orm::MysqlConnection*, trantor::EventLoop*&, std::string&) (in /home/fantasy/test/build/test)
==11618== by 0x4BAC6B: void std::allocator_traits<std::allocator<drogon::orm::MysqlConnection> >::construct<drogon::orm::MysqlConnection, trantor::EventLoop*&, std::string&>(std::allocator<drogon::orm::MysqlConnection>&, drogon::orm::MysqlConnection*, trantor::EventLoop*&, std::string&) (in /home/fantasy/test/build/test)
==11618== by 0x4B9621: std::_Sp_counted_ptr_inplace<drogon::orm::MysqlConnection, std::allocator<drogon::orm::MysqlConnection>, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<trantor::EventLoop*&, std::string&>(std::allocator<drogon::orm::MysqlConnection>, trantor::EventLoop*&, std::string&) (in /home/fantasy/test/build/test)
==11618== by 0x4B7C58: std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<drogon::orm::MysqlConnection, std::allocator<drogon::orm::MysqlConnection>, trantor::EventLoop*&, std::string&>(drogon::orm::MysqlConnection*&, std::_Sp_alloc_shared_tag<std::allocator<drogon::orm::MysqlConnection> >, trantor::EventLoop*&, std::string&) (in /home/fantasy/test/build/test)
==11618== by 0x4B60F9: std::__shared_ptr<drogon::orm::MysqlConnection, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<drogon::orm::MysqlConnection>, trantor::EventLoop*&, std::string&>(std::_Sp_alloc_shared_tag<std::allocator<drogon::orm::MysqlConnection> >, trantor::EventLoop*&, std::string&) (in /home/fantasy/test/build/test)
==11618==
==11618== 3,120 bytes in 15 blocks are definitely lost in loss record 2 of 2
==11618== at 0x4C2F7C8: calloc (vg_replace_malloc.c:1117)
==11618== by 0x96D62E: my_thread_init (my_thr_init.c:340)
==11618== by 0x951174: mysql_server_init (libmysql.c:183)
==11618== by 0x9474C6: mysql_init (client.c:1766)
==11618== by 0x518CCF: drogon::orm::MysqlConnection::MysqlConnection(trantor::EventLoop*, std::string const&) (in /home/fantasy/test/build/test)
==11618== by 0x4BBD56: void __gnu_cxx::new_allocator<drogon::orm::MysqlConnection>::construct<drogon::orm::MysqlConnection, trantor::EventLoop*&, std::string&>(drogon::orm::MysqlConnection*, trantor::EventLoop*&, std::string&) (in /home/fantasy/test/build/test)
==11618== by 0x4BAC6B: void std::allocator_traits<std::allocator<drogon::orm::MysqlConnection> >::construct<drogon::orm::MysqlConnection, trantor::EventLoop*&, std::string&>(std::allocator<drogon::orm::MysqlConnection>&, drogon::orm::MysqlConnection*, trantor::EventLoop*&, std::string&) (in /home/fantasy/test/build/test)
==11618== by 0x4B9621: std::_Sp_counted_ptr_inplace<drogon::orm::MysqlConnection, std::allocator<drogon::orm::MysqlConnection>, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<trantor::EventLoop*&, std::string&>(std::allocator<drogon::orm::MysqlConnection>, trantor::EventLoop*&, std::string&) (in /home/fantasy/test/build/test)
==11618== by 0x4B7C58: std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<drogon::orm::MysqlConnection, std::allocator<drogon::orm::MysqlConnection>, trantor::EventLoop*&, std::string&>(drogon::orm::MysqlConnection*&, std::_Sp_alloc_shared_tag<std::allocator<drogon::orm::MysqlConnection> >, trantor::EventLoop*&, std::string&) (in /home/fantasy/test/build/test)
==11618== by 0x4B60F9: std::__shared_ptr<drogon::orm::MysqlConnection, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<drogon::orm::MysqlConnection>, trantor::EventLoop*&, std::string&>(std::_Sp_alloc_shared_tag<std::allocator<drogon::orm::MysqlConnection> >, trantor::EventLoop*&, std::string&) (in /home/fantasy/test/build/test)
==11618== by 0x4B44CE: std::shared_ptr<drogon::orm::MysqlConnection>::shared_ptr<std::allocator<drogon::orm::MysqlConnection>, trantor::EventLoop*&, std::string&>(std::_Sp_alloc_shared_tag<std::allocator<drogon::orm::MysqlConnection> >, trantor::EventLoop*&, std::string&) (in /home/fantasy/test/build/test)
==11618== by 0x4B1E4E: std::shared_ptr<drogon::orm::MysqlConnection> std::allocate_shared<drogon::orm::MysqlConnection, std::allocator<drogon::orm::MysqlConnection>, trantor::EventLoop*&, std::string&>(std::allocator<drogon::orm::MysqlConnection> const&, trantor::EventLoop*&, std::string&) (in /home/fantasy/test/build/test)
==11618==
==11618== LEAK SUMMARY:
==11618== definitely lost: 3,328 bytes in 16 blocks
==11618== indirectly lost: 0 bytes in 0 blocks
==11618== possibly lost: 0 bytes in 0 blocks
==11618== still reachable: 0 bytes in 0 blocks
==11618== suppressed: 0 bytes in 0 blocks
==11618==
==11618== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)
static auto end =
std::shared_ptr<void>(nullptr, [](void *) {
std::cout << "dddddddddddddddddddddddddddddddd---end" << std::endl;
mysql_library_end(); });
mysql_init(mysqlPtr_.get())
--------------------------------------------------------------------------------------
^C2022-09-19T14:04:16.286183 Info: Shutting down...
dddddddddddddddddddddddddddddddd---end
Error in my_thread_global_end(): 16 threads didn't exit
@an-tao It reduces some memory leak, but It still has memory leak, also need call mysql_thread_end
void DbClientImpl::closeAll()
{
std::lock_guard<std::mutex> lock(connectionsMutex_);
for (auto const &conn : connections_)
{
conn->disconnect();
}
connections_.clear();
readyConnections_.clear();
busyConnections_.clear();
// ------------------------------------------
if (type_ == ClientType::Mysql) {
for (int i = 0; i< loops_.size(); i++) {
loops_.getLoop(i)->runInLoop([] {
mysql_thread_end();
});
}
}
}
https://dev.mysql.com/doc/c-api/5.7/en/mysql-init.html mysql-init not thread safe
please check again, thanks.
please check again, thanks. fixed @an-tao , If this fix is merged, could you create a new Release v1.8.1 ?
==21103== Memcheck, a memory error detector
==21103== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==21103== Using Valgrind-3.17.0 and LibVEX; rerun with -h for copyright info
==21103== Command: ./test
==21103== Parent PID: 33977
==21103==
==21103== Warning: client switching stacks? SP change: 0x7a47a08 --> 0x5f2bf60
==21103== to suppress, use: --max-stackframe=28424872 or greater
==21103== Warning: client switching stacks? SP change: 0x8a49a08 --> 0x5fdf580
==21103== to suppress, use: --max-stackframe=44475528 or greater
==21103== Warning: client switching stacks? SP change: 0x7a46a58 --> 0x5f2baa0
==21103== to suppress, use: --max-stackframe=28422072 or greater
==21103== further instances of this message will not be shown.
==21103==
==21103== HEAP SUMMARY:
==21103== in use at exit: 0 bytes in 0 blocks
==21103== total heap usage: 18,368 allocs, 18,368 frees, 2,483,665 bytes allocated
==21103==
==21103== All heap blocks were freed -- no leaks are possible
==21103==
==21103== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
please check again, thanks. fixed @an-tao , If this fix is merged, could you create a new Release v1.8.1 ?
==21103== Memcheck, a memory error detector ==21103== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. ==21103== Using Valgrind-3.17.0 and LibVEX; rerun with -h for copyright info ==21103== Command: ./test ==21103== Parent PID: 33977 ==21103== ==21103== Warning: client switching stacks? SP change: 0x7a47a08 --> 0x5f2bf60 ==21103== to suppress, use: --max-stackframe=28424872 or greater ==21103== Warning: client switching stacks? SP change: 0x8a49a08 --> 0x5fdf580 ==21103== to suppress, use: --max-stackframe=44475528 or greater ==21103== Warning: client switching stacks? SP change: 0x7a46a58 --> 0x5f2baa0 ==21103== to suppress, use: --max-stackframe=28422072 or greater ==21103== further instances of this message will not be shown. ==21103== ==21103== HEAP SUMMARY: ==21103== in use at exit: 0 bytes in 0 blocks ==21103== total heap usage: 18,368 allocs, 18,368 frees, 2,483,665 bytes allocated ==21103== ==21103== All heap blocks were freed -- no leaks are possible ==21103== ==21103== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
Sure, thanks so much for yor feedback.