Repository navigation
Fix memory leak on macOS - #2092
Merged
Merged
Conversation
xiaopengli89
force-pushed
the
fix-macos-encoder-label-leak
branch
from
October 19, 2021 08:02
454d149 to
3a44e06
Compare
kvark
reviewed
Oct 19, 2021
kvark
left a comment
Member
There was a problem hiding this comment.
Thank you for identifying and fixing the issue!
Just a few notes before we proceed
kvark
approved these changes
Oct 20, 2021
kvark
pushed a commit
to kvark/wgpu
that referenced
this pull request
Oct 22, 2021
* Fix memory RenderCommandEncoder, BlitCommandEncoder, label leak on macOS * Don't wrap autoreleasepool when blit command encoder is already active * Revert wrap set_label, instead focus on gfx-rs/metal-rs#218
kvark
pushed a commit
that referenced
this pull request
Oct 22, 2021
* Fix memory RenderCommandEncoder, BlitCommandEncoder, label leak on macOS * Don't wrap autoreleasepool when blit command encoder is already active * Revert wrap set_label, instead focus on gfx-rs/metal-rs#218
Member
|
Published in wgpu-hal-0.11.4 |
1 task done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Connections
#1783
Description
If we run the water example and open the Activity Monitor, and then do nothing (especially do not move the mouse to the water window), we will observe that the memory of the water process will keep growing. If we use the AMD discrete graphics card, it will grow by several megabytes per second. Using Intel integrated graphics is several hundred kilobytes per second. If we do some operations on the water window (such as moving the mouse), the memory will be reclaimed.
Using Instruments to monitor the memory allocation, confirmed that RenderCommandEncoder, BlitCommandEncoder and label will not be recycled without interaction.
Wrap new_render_command_encoder, new_blit_command_encoder and set_label into an AR pool can resolve the problem.
Testing
Run the water example in the same way and observe the memory changes.