wit-bindgen
wit-bindgen copied to clipboard
c#: perfer using fixed over GCalloc
see:
- https://github.com/bytecodealliance/wit-bindgen/pull/1138#issuecomment-2624776578
- https://github.com/bytecodealliance/wit-bindgen/pull/1145#discussion_r1936315005
- https://github.com/bytecodealliance/wit-bindgen/pull/1138#issuecomment-2624961668
- https://github.com/bytecodealliance/wit-bindgen/pull/1138#issuecomment-2624776578
It is then "best practice" to keep stack allocations small (all stackallocs for a single method should typically add up to not more than 1024 bytes) and to never make them "dynamic" in length (instead rounding up to the largest buffer size).
From https://github.com/dotnet/runtime/issues/52065#issuecomment-2411550400