Andrey has implemented a little mysqlnd only addition to mysqli_debug(): ‘m’ – dump memory information. It works like the other options described in PHP: Debugging ext/mysqli and mysqlnd with the only difference that it is only available with mysqlnd.
Without option ‘m’
This is a short example of mysqlnd freeing the meta data of a result set.
[...] | | | >mysqlnd_res_meta::free | | | | info : persistent=0 | | | | info : Freeing fields metadata | | | | info : Freeing zend_hash_keys | | | | info : Freeing metadata structure | | | >mysqlnd_res_meta::free [...]
Additional mysqlnd memory allocation debug information with option ‘m’
Same trace excerpt but with memory debugging turned on. The control string used for this trace was ‘t:O,/tmp/mysqlnd.trace:m’.
[...] | | | >mysqlnd_res_meta::free | | | | info : persistent=0 | | | | info : Freeing fields metadata | | | | >_mysqlnd_pefree | | | | | info : file=mysqlnd_result_meta.c line= 37 | | | | | info : ptr=0xb7b5d2e8 persistent=0 | | | | | info : before: 322788 | | | | | info : after : 322788 | | | | <_mysqlnd_pefree | | | | >_mysqlnd_pefree | | | | | info : file=mysqlnd_result_meta.c line= 37 | | | | | info : ptr=0xb7b608f8 persistent=0 | | | | | info : before: 322788 | | | | | info : after : 322788 | | | | <_mysqlnd_pefree | | | | >_mysqlnd_pefree | | | | | info : file=mysqlnd_result_meta.c line= 272 | | | | | info : ptr=0xb7b52bc0 persistent=0 | | | | | info : before: 322788 | | | | | info : after : 322452 | | | | <_mysqlnd_pefree | | | | info : Freeing zend_hash_keys | | | | >_mysqlnd_pefree | | | | | info : file=mysqlnd_result_meta.c line= 287 | | | | | info : ptr=0xb7b607ac persistent=0 | | | | | info : before: 322452 | | | | | info : after : 322452 | | | | <_mysqlnd_pefree | | | | info : Freeing metadata structure | | | | >_mysqlnd_pefree | | | | | info : file=mysqlnd_result_meta.c line= 291 | | | | | info : ptr=0xb7b5d490 persistent=0 | | | | | info : before: 322452 | | | | | info : after : 322452 | | | | <_mysqlnd_pefree | | | <mysqlnd_res_meta::free [...]