Bug #48281 mysqlbinlog prints warning about unfreed memory
Submitted: 24 Oct 2009 14:08 Modified: 24 Oct 2009 20:56
Reporter: Sergey Petrunya Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:5.1 OS:Linux (x86 Ubuntu Jaunty)
Assigned to: Assigned Account CPU Architecture:Any

[24 Oct 2009 14:08] Sergey Petrunya
Description:
Running mysqlbinlog with --debug option causes the following warning to be produced:

Warning: Memory that was not free'ed (456 bytes):
	   456 bytes at 0x86f84d8, allocated at line  201 in 'my_alloc.c'

How to repeat:
Start a server with the following arguments: 

  ./mysqld --log-bin --server-id=1  

Connect with a client and run these statements:

 create database j221;
 use j221;
 create table t1 (a int);
 insert into t1 values (1000);
 flush logs;

Then run

./client/mysqlbinlog -uroot --debug  --verbose --base64-output=decode-rows -R -t --start-position=0 --host=localhost  pslp2-bin.000024

(pslp2-bin.000024 is the name of the next-to-last binary log)

And see the SQL output, followed by:
Warning: Not freed memory segments: 1
Warning: Memory that was not free'ed (456 bytes):
	   456 bytes at 0x86f84d8, allocated at line  201 in 'my_alloc.c'

Suggested fix:
I haven't investigated it in detail, but it seems that the contents of the binary log are irrelevant - one gets the same warning every time.

Although not freeing 456 bytes is harmless, the warning should be avoided so it doesn't obscure possible real problems.
[24 Oct 2009 20:56] MySQL Verification Team
Thank you for the bug report. Verified as described.

# at 4
#691231 21:00:00 server id 1  end_log_pos 0 	Rotate to laras-bin.000002  pos: 4
# at 4
#091024 18:47:02 server id 1  end_log_pos 106 	Start: binlog v 4, server v 5.1.41-debug-log created 091024 18:47:02
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
Warning: Not freed memory segments: 1
Warning: Memory that was not free'ed (452 bytes):
	   452 bytes at 0xf7e798, allocated at line  201 in 'my_alloc.c'
miguel@laras:~/dbs$