Memory leaks in 'mysqlbinlog'Several of the 'mysqlbinlog' tests fail due to memory leaks in the 'mysqlbinlog' client program. Here are the details from the 'main.mysqlbinlog' test. It appears the binlog event objects are not always deleted after being created by the 'dump_remote_log_entries' function.
See MySQL bugs 78966 and 78223 for status.
Memory leaks in 'mysqlpump'All of the 'mysqlpump' tests fail due to memory leaks in the 'mysqlpump' client program. Here are the details from the 'main.mysqlpump_basic' test. The first memory leak occurs in the 'quote_name' function, which gets a object pointer and then just dicards it. Other memory leaks are caused by a similar disregard for object management. Unfortunately, C++ requires the programmer to manage memory. Use of the Address Sanitizer when developing and testing new C++ software like 'mysqlpump' will quickly identify the memory leaks.
See MySQL bugs 78965 and 78224 for status.
Memory leaks in InnoDBSeveral InnoDB tests fail due to memory leaks in the InnoDB storage engine when running the mysqld server. Here are the details from the 'log_file_name' test. The memory leaks occur because InnoDB calls the 'exit' system call from its initialization function rather than passing an error back to the mysqld server code. Since InnoDB can abruptly terminate mysqld, this sets a precedent that allows any storage engine or plugin to do the same when it encounters a problem. IMO, a plugin should not be allowed to terminate the mysql server especially for a 'simple' case of an error during plugin initialization.
ConclusionsSince it is really easy to leak memory in C++ programs, C++ developers should use a memory verification tool like valgrind's memcheck or the Address Sanitizer to find memory leaks. Since support for the Address Sanitizer is built into MySQL, it should be used when hacking on MySQL software. Furthermore, since the executing cost of the Address Sanitizer is reasonable (IMO), it could be used in an automated MySQL test system.
I have only run the 'main' and 'innodb' mysql tests suites with the Address Sanitizer. There are plenty of additional tests suites that are part of the MySQL software that should be run with the Address Sanitizer.
Address Sanitizer built into Clang 3.8