Using mysqli_free_result is taking up more memory than not using it suprisingly.
Could anyone verify this? If so then why should anyone want to use it?
I'm using php 5.1. and testing by putting echo memory_get_usage() at the bottom of my scripts.
| SitePoint Sponsor |
Using mysqli_free_result is taking up more memory than not using it suprisingly.
Could anyone verify this? If so then why should anyone want to use it?
I'm using php 5.1. and testing by putting echo memory_get_usage() at the bottom of my scripts.


I would think you'd want to use it when making many queries with large result sets in a single script. Otherwise there's no benefit, as the resources will be freed when execution ends automatically.
17-29% of paid ad clicks are fraudulent. Get protected with Improvely, your online marketing dashboard.
→ Conversion tracking, click fraud detection, A/B testing and more.
Thanks for you input, here is a quote from php.net
"Note: You should always free your result with mysqli_free_result(), when your result object is not needed anymore."
echo memory_get_usage();
mysqli_free_result($res);
echo memory_get_usage();
The above scripts returns more memory usage for me after free_result is executed.
What is considered large result sets? LONGBLOBS?
Bookmarks