wit-bindgen icon indicating copy to clipboard operation
wit-bindgen copied to clipboard

c#: perfer using fixed over GCalloc

Open jsturtevant opened this issue 1 year ago • 1 comments

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

jsturtevant avatar Jan 30 '25 21:01 jsturtevant

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

pavelsavara avatar Feb 05 '25 11:02 pavelsavara