You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
can't be optimized with traditional stackalloc or Span because of the generic type. It could be possible by working with a byte[] and converting elements in and out from T. Or having static class-wide caching array that grows when required (still garbage-prone, but much less).
This being said, polling GetData every frame isn't a good practice and it is recommended to rework your logic to avoid relaying on GetData this much.
Prerequisites
develop
branchMonoGame Version
3.8.1
Which MonoGame platform are you using?
MonoGame Cross-Platform Desktop Application (mgdesktopgl)
Operating System
Windows
Description
Getdata allocates an extra array of T[] GC runs reducing the frame rate
Steps to Reproduce
Minimal Example Repo
No response
Expected Behavior
No extra allocations needed
Resulting Behavior
Color[] is allocated each frame
Files
No response
The text was updated successfully, but these errors were encountered: