Do not create the opcache shm mapping too close to the heap #14793
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Under some conditions we may allocate the opcache shm segment just after the heap, which prevents it from expanding. Malloc continues to work (it fallbacks to mmap()), but in #13775 this leads to a significant increase in VMA and RSS. The exact reason is unidentified, but we can make a few hypotheses:
[heap]
label the fallback mmap, or by the non-contiguous heap (e.g. some code relying on heap scanning would not see the entire heap).Here I change find_prefered_mmap_base() so that it doesn't return an address too close to the end of the heap.
This fixes #13775.
I also backport a2af8ac from 8.3, otherwise no good candidate is found if all gaps before the heap are too large.