Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Don't allocate a full-sized array when creating a VertexBuffer. #14513
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.