Skip to content

Commit 654cec9

Browse files
authored
Fix memory leaks (#181)
* fix memory leaks * flush the entire sandbox container * Apply fixes from StyleCI (#186)
1 parent 9522859 commit 654cec9

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/Worker.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Laravel\Octane;
44

55
use Closure;
6+
use Illuminate\Container\Container;
67
use Illuminate\Foundation\Application;
78
use Illuminate\Http\Request;
89
use Laravel\Octane\Contracts\Client;
@@ -110,6 +111,11 @@ public function handle(Request $request, RequestContext $context): void
110111
} catch (Throwable $e) {
111112
$this->handleWorkerError($e, $sandbox, $request, $context, $responded);
112113
} finally {
114+
$sandbox->flush();
115+
116+
$this->app->make('view.engine.resolver')->forget('blade');
117+
$this->app->make('view.engine.resolver')->forget('php');
118+
113119
// After the request handling process has completed we will unset some variables
114120
// plus reset the current application state back to its original state before
115121
// it was cloned. Then we will be ready for the next worker iteration loop.

0 commit comments

Comments
 (0)