This repository has been archived by the owner on Sep 7, 2022. It is now read-only.
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.
In this PR we aims to fix a potential OOM bug observed on android/ios devices.
The bug is caused by the fact that: in one frame, a CompositorContext is used to preroll and the paint the layer tree which holds a rasterize cache to boost the performance. Generally, it will first generate the cache in the preroll call and then at the end of the frame, it will release unused cache when the unique pointer of
compositor_frame
is released and the methodCompositorContext::ScopedFrame::~ScopedFrame()
is called. Note that since the cache holds shared memory between gpu and cpu, it is important to keep a valid gpu context while doing the release job.However, in one PR I made before, it mistakenly clears the gpu context before the
compositor_frame
is released (which happens when the whole function is finished and the specific unique pointer is out of scope). As the result, the gpu side memory might be unable to be released properly.To fix this issue, we just guarantee that we clear the gpu context only after the
compositor_frame
is released