Bug #43237 Add Bytes_allocated to SHOW STATUS for #bytes currently allocated in MEM_ROOT
Submitted: 26 Feb 2009 16:21 Modified: 26 Aug 2013 8:46
Reporter: Mark Callaghan Email Updates:
Status: Closed Impact on me:
Category:MySQL Server: General Severity:S4 (Feature request)
Version:6.0, 5.1, 5.0 OS:Any
Assigned to: Marc Alff CPU Architecture:Any
Tags: Contribution, Leak, MEM_ROOT, show, STATUS
Triage: Needs Triage: D5 (Feature request)

[26 Feb 2009 16:21] Mark Callaghan
This bug caused a lot of pain for many customers http://bugs.mysql.com/bug.php?id=27732. It is very hard to debug. You can make it much simpler to spot leaks from MEM_ROOT by counting the number of bytes currently allocated in MEM_ROOT instances and exporting that counter via SHOW STATUS. 

New tests could also use that to check for leaks -- compare value at test start and with results later in the test.

How to repeat:

Suggested fix:
[26 Feb 2009 16:35] Mark Callaghan
Partial patch for this feature based on 5.0.37 with Google patch

Attachment: ba (application/octet-stream, text), 3.51 KiB.

[26 Feb 2009 16:36] Mark Callaghan
I have attached the diff for the change we made to MySQL 5.0.37 + the Google patch. This is partial and the implementation was convenient rather than the best way to do this (but it works and is efficient for us). Also, I do not show the changes for SHOW STATUS.
[27 Feb 2009 6:55] Valeriy Kravchuk
Thank you for the feature request.
[26 Aug 2013 8:46] Marc Alff
The performance schema in 5.7.2 now include memory instrumentation.