I can use both ini_set('memory_limit', '512M'); in the file and php -d memory_limit=512M from the command line, but can also trace memory usage from terminal?
I know I can use memory_get_usage() inside a PHP file, but how to trace it from the command line?
php -r "var_dump(memory_get_usage());"watch -n 1I will see how usage is changing while during the runtime. Is there a better way to find out?php -r "var_dump(memory_get_usage());"will not help you, because itReturns the amount of memory allocated to PHP. You need to passtrueas parameter to see the real used memory.