You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
rotatePHPRuntime: track occupied memory, rotate the PHP runtime automatically when necessary #998
#990 introduced a rotatePHPRuntime function that swaps the internal PHP runtime for a fresh one after a certain number of requests are handled. This is necessary because PHP has a memory leak and exhaust the HEAP space eventually.
Ideally the rotation logic would be based on the amount of free, unfragmented memory.
The challenge there is to find a fast method of keeping track of that – even a naive approach of calculating the null bytes takes a few blocking seconds.
Ideally the rotation logic would be based on the amount of free, unfragmented memory.
I'm not sure that's necessary or ideal. It seems like the highest-allocated address would serve as a reasonable proxy for memory use, particularly of growing memory use.
And this is because even if we have purely fragmented memory, if we aren't extending the allocated range then we're not growing overall use. On the other hand, memory could be entirely unfragmented and we could still fail to acquire a span large enough for a chunk being requested.
My original thought was to track the highest allocated address and after a given threshold, swap out the runtime.
Activity
dmsnell commentedon Feb 5, 2024
I'm not sure that's necessary or ideal. It seems like the highest-allocated address would serve as a reasonable proxy for memory use, particularly of growing memory use.
And this is because even if we have purely fragmented memory, if we aren't extending the allocated range then we're not growing overall use. On the other hand, memory could be entirely unfragmented and we could still fail to acquire a span large enough for a chunk being requested.
My original thought was to track the highest allocated address and after a given threshold, swap out the runtime.