Help, I'm Running Out of Memory!
summary
Numbers and tools decide: PHP uses a 256KB segment allocator called Zend Memory Manager that cuts malloc/free calls (example test drops ~2,000,000 allocations to ~22,000), costs ~10% more resident memory but runs ~10% faster, and reports allocation via memory_get_usage versus memory_get_usage(true). Use /proc, pmap -x, smaps, Valgrind, Xdebug and the memprof extension to see which lines and requires consume dozens or hundreds of MB (range(), file_get_contents(), DOM parsing, big DB result sets); APC typically raises shared memory, not lowers per-request usage.
AI-written summary · about
chapters (12)
- 0:00Intro
- 2:06What we'll cover together
- 2:40Memory from hardware
- 6:44Linux memory monitoring
- 15:49Why a custom layer ?
- 17:24Zend MM test script
- 19:22Zend MM launch test
- 23:53A quick word on ZendMM internals
- 27:16ZendMM memory monitoring
- 32:35PHP Variables
- 39:26Monitoring memory usage
- 45:32Thank you for listening
related talks
36mMemory Leaks in PHP: Detection, Prevention, Tooling
50mPerformance optimization: how do I go about it?
22mHunting down memory leaks with PHP Meminfo
31mPHP in 2018
52mPerformance optimisation: how do I go about it?
38m25 years of PHP
39mPHP Performance Demystified - Measure, Understand, Optimise
56mPHP OPCache, Realpath Cache and Preloading
