This is in the documentation:
The MySQL Native Driver manages memory different than the MySQL Client Library. The libraries differ in the way memory is allocated and released, how memory is allocated in chunks while reading results from MySQL, which debug and development options exist, and how results read from MySQL are linked to PHP user variables.
All memory allocation and deallocation is done using the PHP memory management functions. Therefore, the memory consumption of mysqlnd can be tracked using PHP API calls, such as memory_get_usage().
I am using PHP 5.4 so MySQL extensions are compiled with use of mysqlnd driver. Even that documentation says that all memory management for mysqlnd is done via PHP I can't see any memory usage after query to table which returns cca 1MB BLOB result set. The query is used in buffered (mysql_store_result()) mode:
$result = $conn->query('SELECT * FROM test');
echo memory_get_usage()/1024;
Why memory_get_usage() doesnt show memory usage boost after the query ?
I thought that query() returns whole result set from MySQL server to mysqlnd when buffered mode is used.