简体   繁体   中英

MySQL related memory leaks

My webcrawler available at https://github.com/JamesRead5737/webcrawler is experiencing a number of MySQL related memory leaks. Valgrind reports a number of MySQL related memory leaks but none of the stack traces point to any lines of my code. Just MySQL code. Here is the most extreme example:

==58360== 16,528 bytes in 1 blocks are possibly lost in loss record 410 of 410
==58360==    at 0x483B7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==58360==    by 0x49D76F7: my_raw_malloc (my_malloc.cc:199)
==58360==    by 0x49D76F7: my_malloc(unsigned int, unsigned long, int) (my_malloc.cc:81)
==58360==    by 0x49E6199: allocate (malloc_allocator.h:98)
==58360==    by 0x49E6199: allocate (alloc_traits.h:306)
==58360==    by 0x49E6199: _M_allocate (stl_vector.h:343)
==58360==    by 0x49E6199: _M_default_append (vector.tcc:635)
==58360==    by 0x49E6199: resize (stl_vector.h:937)
==58360==    by 0x49E6199: file_info::RegisterFilename(int, char const*, file_info::OpenType) (my_file.cc:196)
==58360==    by 0x49D7CBB: my_open(char const*, int, int) (my_open.cc:84)
==58360==    by 0x49D0954: inline_mysql_file_open (mysql_file.h:993)
==58360==    by 0x49D0954: my_read_charset_file(MY_CHARSET_LOADER*, char const*, int) (charset.cc:378)
==58360==    by 0x49D15E1: init_available_charsets() (charset.cc:448)
==58360==    by 0x55C647E: __pthread_once_slow (pthread_once.c:116)
==58360==    by 0x49D107D: __gthread_once (gthr-default.h:700)
==58360==    by 0x49D107D: void std::call_once<void (&)()>(std::once_flag&, void (&)()) (mutex:683)
==58360==    by 0x49D2022: my_charset_get_by_name(MY_CHARSET_LOADER*, char const*, unsigned int, int) (charset.cc:652)
==58360==    by 0x49D210E: get_charset_by_csname(char const*, unsigned int, int) (charset.cc:670)
==58360==    by 0x498021B: mysql_set_character_set_with_default_collation (client.cc:3688)
==58360==    by 0x498021B: mysql_init_character_set(MYSQL*) (client.cc:3719)
==58360==    by 0x498041A: csm_parse_handshake(mysql_async_connect*) (client.cc:6287)

Any ideas how to track down and fix this memory leak?

mysql_library_end() was missing.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM