From e08a1518a2cae1fabb4149b8a97f88d65c5912a6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= <kevin@dunglas.fr>
Date: Thu, 26 Oct 2023 23:40:42 +0200
Subject: [PATCH] frankenphp-symfony: call gc_collect_cycles() after handling
 request

---
 src/frankenphp-symfony/src/Runner.php | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/frankenphp-symfony/src/Runner.php b/src/frankenphp-symfony/src/Runner.php
index 46c8378..73c9e0b 100644
--- a/src/frankenphp-symfony/src/Runner.php
+++ b/src/frankenphp-symfony/src/Runner.php
@@ -16,11 +16,8 @@
  */
 class Runner implements RunnerInterface
 {
-    private HttpKernelInterface $kernel;
-
-    public function __construct(HttpKernelInterface $kernel)
+    public function __construct(private HttpKernelInterface $kernel)
     {
-        $this->kernel = $kernel;
     }
 
     public function run(): int
@@ -40,6 +37,8 @@ public function run(): int
             if ($this->kernel instanceof TerminableInterface && $sfRequest && $sfResponse) {
                 $this->kernel->terminate($sfRequest, $sfResponse);
             }
+
+            gc_collect_cycles();
         } while ($ret);
 
         return 0;