~/talk

Writing Allocation Free Code in C#

Talkat Øredev 2018 · on Monday, 2018-11-19· [c-sharp]
slides:none on file

Shows concrete ways to cut memory traffic: use Span<T> and ref struct to slice strings and arrays without copies, use ref returns/refs and in parameters to avoid copies, prefer ValueTask where tasks allocate, and beware hidden allocators like params arrays, boxing, closures, yield and async state machines. Demo uses DotMemoryUnit and asserts zero allocations when slicing into a span. Practical claim: less allocation reduces GC pauses and smooths latency; tools and runtime support determine whether each technique actually avoids an allocation.

AI-written summary · about

  1. 0:00Introduction
  2. 3:57Using less memory
  3. 5:02Know your platform
  4. 6:56Reduce your allocations
  5. 9:33Reference types and value types
  6. 12:28Heap vs stack
  7. 15:39Closures
  8. 19:22Reference Semantics
  9. 22:36Ref Return
  10. 24:33Ref Local
  11. 25:38Example Code
  12. 28:28In Parameters
  13. 29:38Defensive Copy
  14. 32:21Ref ReadOnly
  15. 33:50ReadOnly struct
  16. 34:42Ref struct
  17. 35:46Span
  18. 37:05System Memory
  19. 37:58Performance
  20. 39:06Thread Safety
  21. 40:23Demo
  22. 42:02Useful links
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.