Codexworker

PHP Memory Leak Investigation

Memory usage climbs with every request until the PHP process is killed, or a long-running worker exhausts memory over time. I trace exactly what holds memory — static caches, unclosed resources, large result sets, or a loop that accumulates data.

I'm a backend developer with 10+ years of experience across PHP, Go, MySQL and Elasticsearch. Recent work includes Cenoskop (30M+ products daily), Niftycent (US price intelligence), and facha.sk (Go backend). I build, fix and optimize backend systems that handle real data and real traffic.

What I Can Help With

Find what causes PHP memory usage to grow until the process dies.

Typical Problems

memory growth per request worker processes getting killed OOM kills on PHP-FPM static caches growing unbounded unclosed file/db resources large result sets held in memory leaks in long-running PHP daemons

Relevant Experience

Tracked a memory leak in a long-running PHP worker at Cenoskop — a Symfony command that accumulated Doctrine entity references in a static cache over 12+ hours. Found it using tideways heap snapshots comparing memory at hour 1 vs hour 6. The fix was a 3-line change to detach entities after processing.

What Is Included

memory profiling (XHProf/tideways)
request lifecycle review
static/cache analysis
resource leak analysis
heap snapshot comparison
root cause identification
fix recommendations

How It Works

You share memory usage data (or I add profiling for a sampling run). I compare heap snapshots at different points, find what's retained between requests or growing over time, and point at the exact code path. Most cases resolve in one focused session.

Starting from €399

Investigation and a written diagnosis with the fix location. Implementation is quoted separately.

Frequently Asked Questions

Is a memory leak in PHP ever just normal growth?

Yes. Frameworks and caches grow predictably per request up to a plateau. A real leak keeps climbing past the plateau until PHP-FPM kills the worker. I distinguish the two.

Can you find it without restarting PHP?

Yes. Memory profiling and heap snapshots let me see what's retained between requests without a restart.

Related Services

Other problems I help with.

PHP Performance Optimization

Profile and optimize PHP applications that are slow, memory-heavy or consuming too much CPU.

Details →

Why Is PHP Using So Much CPU?

Find what drives high CPU in PHP production.

Details →

Slow PHP Application? I'll Find the Bottleneck

Diagnose why a PHP application is slow, no rewrite required.

Details →

Backend Performance Audit

Find and prioritize the real bottlenecks across your full backend stack.

Details →

Systems I've Built

Relevant production work.

Traffic Analysis

AnalyticsForWebsite

Custom solution for collecting and evaluating traffic metrics with emphasis on processing speed and minimizing backend load.

Designed and built the backend for fast traffic metric collection and evaluation.

Performance Optimization Data Collection
Price Intelligence Engine

Cenoskop / Levnobot

Crawler monitoring millions of products. Processing 30M products daily and comparing them.

Built and maintain the full crawling pipeline — from scraping through Elasticsearch indexing to price comparison.

Data Aggregation Scraping ElasticSearch
US Price Intelligence

Niftycent

Price intelligence engine for the US market. Processing large-scale product data.

Built the data pipeline and crawling infrastructure for large-scale US product monitoring.

Data Aggregation Scraping Big Data
Secure Communication

Paidshield

Chat application with end-to-end encryption.

Built the backend and encryption layer for a secure chat application.

End-to-End Encryption Real-time Communication Security
Job & Services Marketplace

facha.sk

Find a job or offer your services.

Built the Go backend — API, matching logic and deployment.

Job Marketplace Services Go

Need Help With This?

Describe the problem in a few lines — I'll look at it and tell you what I think.

Request a memory leak investigation