Hacker News new | ask | show | jobs
by giannischatz 23 days ago
A thing worth adding for anyone reading: in long-running PHP processes (workers, queue runners, Laravel Octane), the overhead of malloc/free patterns compounds in ways the request/response model hides.

A page handler that leaks 2KB per request is invisible under php-fpm (the process dies on the next request anyway) but becomes a slow memory creep in a queue worker that runs for hours. The fix usually isn't "call unset more" — it's recognizing which objects Zend's refcount can't collect without a full GC cycle (circular references, mostly), and forcing `gc_collect_cycles()` at known-safe points.

Took me a while to realize that in production.