Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force buffered sheets to commit data to a texture on buffer release. #14984

Merged
merged 1 commit into from Apr 29, 2018

Conversation

Projects
None yet
3 participants
@RoosterDragon
Copy link
Member

RoosterDragon commented Mar 23, 2018

Previously ReleaseBuffer did not immediately null out the buffer, instead the releaseBufferOnCommit flag allows it to be nulled when the texture is next access and the pending changes from the buffer are committed to it. Now the texture is committed immediately, thus the buffer is null once ReleaseBuffer returns.

Once loaded, we force a GC to reclaim temporary memory used during loading. Previously the buffer would not be null as it was pending commit to the texture and thus could not be reclaimed. As soon as we rendered the first frame, the buffer is nulled but we are now in a low GC state - and the buffer will not be reclaimed until the next gen 2 GC which may be dozens of minutes away.

This change ensures the buffer is null in time for the post-load GC, and thus can be reclaimed before we start rendering.

Reduces memory use post-loading by 34MB on the RA shellmap - similarly when starting games.

@reaperrr

This comment has been minimized.

Copy link
Contributor

reaperrr commented Mar 23, 2018

OpenRA.Utility(1,1): Error: Failed with exception: System.NullReferenceException: Object reference not set to an instance of an object
  at OpenRA.Graphics.Sheet.GetTexture () [0x0000d] in /home/travis/build/OpenRA/OpenRA/OpenRA.Game/Graphics/Sheet.cs:69 

See Travis if more details are needed.

Force buffered sheets to commit data to a texture on buffer release.
Previously ReleaseBuffer did not immediately null out the buffer, instead the releaseBufferOnCommit flag allows it to be nulled when the texture is next access and the pending changes from the buffer are committed to it. Now the texture is committed immediately, thus the buffer is null once ReleaseBuffer returns.

Once loaded, we force a GC to reclaim temporary memory used during loading. Previously the buffer would not be null as it was pending commit to the texture and thus could not be reclaimed. As soon as we rendered the first frame, the buffer is nulled but we are now in a low GC state - and the buffer will not be reclaimed until the next gen 2 GC which may be dozens of minutes away.

This change ensures the buffer is null in time for the post-load GC, and thus can be reclaimed before we start rendering.

@RoosterDragon RoosterDragon force-pushed the RoosterDragon:force-buffer-release branch from 5d6af08 to 688a17d Mar 25, 2018

@pchote

pchote approved these changes Apr 29, 2018

@pchote pchote added the PR: Needs +2 label Apr 29, 2018

@reaperrr reaperrr merged commit 7bc5bd5 into OpenRA:bleed Apr 29, 2018

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@RoosterDragon RoosterDragon deleted the RoosterDragon:force-buffer-release branch May 14, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.