4 ms·
Search the repo for "new" and you'll see that everything is allocated at construction time. Everything hangs off the window class so essentially all memory is
by jayd16 7y ago
Search the repo for "new" and you'll see that everything is allocated at construction time. Everything hangs off the window class so essentially all memory is allocated as the project starts up. You'd probably want to pre-allocate in any language because but this also relieves GC pressure.
Another thing you can do in C# is leverage stack allocation using structs.
- WorldMaker 7y agoRelatedly, the new .NET Span<T> APIs open up a lot more opportunities for stack allocation and "pointer arithmetic-style" work in "safe" code. Span<T> is really fascinating at the performance opportunities it opens in .NET (and real performance gains already achieved in, for instance, ASP.NET Core).