Real Kernel RSS Tracking
Direct /proc/self/statm inspection on Linux to track actual Resident Set Size and catch native C-extension memory growth outside the Zend VM heap.
The autonomous runtime guardian and static analysis engine for persistent PHP workers (FrankenPHP, RoadRunner, Swoole, Symfony, Laravel & Vanilla).
composer require themattosdev/leaklesscomposer require --dev themattosdev/leakless-devLEAKLESS_ENABLED=true
LEAKLESS_MAX_DRIFT_MB=64
LEAKLESS_CHECK_TRANSACTIONS=true
LEAKLESS_CHECK_FILE_DESCRIPTORS=falseuse TheMattos\Leakless\DTOs\Config;
use TheMattos\Leakless\Integrations\FrankenPhp\FrankenPhp;
FrankenPhp::run(
app: fn () => print(json_encode(['status' => 'ok'])),
config: new Config(
maxDriftMb: 64,
checkTransactions: true,
resettables: [
App\Services\CartSession::class,
fn () => LegacyStatic::$cache = [],
],
),
);test('orders endpoint executes cleanly without state or memory drift', function () {
// 1. Structural reflection check
expect(PaymentGateway::class)->toBeLeakless();
// 2. Request lifecycle & Kernel RSS drift check
expect(function () {
(new ProcessInvoicesJob())->handle();
})->toRunCleanly(maxDriftMb: 0.25);
// 3. Container singletons state mutation snapshot
expect(app())->toResetContainerState(function () {
$this->postJson('/api/checkout', ['plan' => 'pro']);
});
});vendor/bin/leakless analyze