Multiple calls to Cache::get within while loop causing incremental memory leak #54213
Replies: 4 comments
-
Do you have the same issue if you disable telescope? |
Beta Was this translation helpful? Give feedback.
-
@cosmastech Interestingly in a fresh install of Laravel, with Telescope, the problem still occurs. Turning Telescope off in this project and the memory doesn't leak. In a much larger project with Telescope turned off, the memory is still leaking. I even tried calling |
Beta Was this translation helpful? Give feedback.
-
I would garbage collect, via I would also recommend turning off events to see if that is where the problem lies. You can do this by specifying |
Beta Was this translation helpful? Give feedback.
-
I'll give that a shot. I did try the garbage collection but it didn't return any cycles. Garbage collection was enabled when I checked the gc enabled method |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Laravel Version
11.35.1
PHP Version
8.3.8
Database Driver & Version
MySql 8
Description
Multiple calls within
while (true)
loop toCache::get()
is causing incremental memory consumption (leak) when called from a custom artisan command ran within the terminal. See attached screenshots:I'm using Redis as my cache driver locally here and in production. I'm using Laravel telescope locally.
Without the
Cache::get
blockWith the
Cache::get
blockSteps To Reproduce
Additionally, I have tried adding the following block of code to my project and calling it:
Still creating a memory leak after 10 seconds.
Additional context
I've just tried some other things, replacing
dump()
withecho
, still get the same memory leak.Interestingly the problem doesn't happen when simply echoing other facades like:
str()->random(32)
ornow()
Beta Was this translation helpful? Give feedback.
All reactions