4

I was recently reading about memory leaks and profiling and found a really excellent article for people new to c# or best practices. It's a great article and well worth the read if you're still learning.

https://michaelscodingspot.com/find...

Comments
  • 0
    You cannot leak memory in a garbage collected run time
  • 2
    @beegC0de oh yes you can, wpf is a major issue especially xaml.
  • 0
    @beegC0de it's literally discussed (and thus answered) in the section following the first subheading:
    "In a garbage collected environment, the term memory leaks is a bit counter intuitive. How can my memory leak when there’s garbage collector (GC) that takes care to collect everything?"
  • 0
    Depends on how you think of a memory leak. You can't not have 0 references to an allocation in a gc'd memory model and have it skipped by the GC unless the language has unmanaged memory allocations, so technically you can't leak memory. References held for a long time by GC aren't leaked, but it will seem like they never get garbage collected because something static is holding a reference.
  • 0
    @beegC0de

    technically correct, but potato potahto.
  • 1
    @Wisecrack both cause increased heap usage :P
Add Comment