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

Don't allocate a full-sized array when creating a VertexBuffer. #14513

Merged
merged 1 commit into from Dec 18, 2017

Conversation

Projects
None yet
3 participants
@RoosterDragon
Member

RoosterDragon commented Dec 15, 2017

We can allocate a much smaller zeroed buffer and copy that multiple times in order to zero the memory. When creating large VertexBuffers, this caps our temporary allocation size significantly.

Helps with #12494 by reducing garbage generated during loading. On a 128x128 map, this allocates a temporary buffer of size 130x130x6x36 bytes (130x130 for map size with border, 6 vertices per tile, 36 bytes per vertex). That's 3.5 Mb for a buffer that will immediately be thrown away! We currently generate like 5 buffers of this size during loading. This can tip you into out-of-memory during loading before the GC has a chance to save you. Reducing the allocation here gives you more headroom during loading.

Don't allocate a full-sized array when creating a VertexBuffer.
We can allocate a much smaller zeroed buffer and copy that multiple times in order to zero the memory. When creating large VertexBuffers, this caps our temporary allocation size significantly.

@pchote pchote added this to the Next release milestone Dec 18, 2017

@pchote

pchote approved these changes Dec 18, 2017

@pchote pchote added the PR: Needs +2 label Dec 18, 2017

@abcdefg30 abcdefg30 merged commit 3f8c1ad into OpenRA:bleed Dec 18, 2017

2 checks passed

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

This comment has been minimized.

Show comment
Hide comment
@abcdefg30
Member

abcdefg30 commented Dec 18, 2017

@RoosterDragon RoosterDragon deleted the RoosterDragon:vertex-buffer-less-alloc branch Dec 19, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment