Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Memory

Memory refers to the portion of server RAM that PHP uses to execute scripts.

Whenever a PHP application runs, it needs memory to load the PHP engine, parse the code, store data and various caches.

Memory usage is controlled by the memory_limit directive, and functions like memory_get_usage().

PHP handles the memory management, and there is little more to do beyond setting the overall limit, although some features may become memory hungry easily, such as array_merge() in loops, or the N+1 query problem.

Documentation

See Also