Have you ever checked how much memory your PHP script takes when it runs. To check memory usage, PHP provides in-built function memory_get_usage(). This function returns the amount of memory allocated to PHP.
** memory_get_usage() function returns the amount of memory in bytes.
To convert them in KB – memory_get_usage/1024
To convert them in MB – memory_get_usage/1048576
Check Memory Usage by PHP Script
Let’s check it through very simple example.
It is very useful to know how much memory is allocated during your PHP script execution, so that We can avoid any type of fatal error.
** memory_get_usage() function returns the amount of memory in bytes.
To convert them in KB – memory_get_usage/1024
To convert them in MB – memory_get_usage/1048576
Check Memory Usage by PHP Script
Let’s check it through very simple example.
It is very useful to know how much memory is allocated during your PHP script execution, so that We can avoid any type of fatal error.
0 comments:
Post a Comment