ObjectTK icon indicating copy to clipboard operation
ObjectTK copied to clipboard

GLResource.cs has unnecessary `GC.KeepAlive(this)` call.

Open john-h-k opened this issue 6 years ago • 3 comments

this cannot be disposed during execution of one of its methods. Dispose is an instance member. Call is unnecessary and will just slightly hurt perf

john-h-k avatar Mar 16 '19 07:03 john-h-k

These articles say something different:

  • https://devblogs.microsoft.com/oldnewthing/20100813-00/?p=13153
  • https://blogs.msdn.microsoft.com/oldnewthing/20100810-00/?p=13193/

An object can become eligible for collection during execution of a method on that very object.

JcBernack avatar Mar 16 '19 09:03 JcBernack

Yes, it is useful in a finalizer. But this is in Dispose, where it is useless

john-h-k avatar Mar 16 '19 10:03 john-h-k

Put it in the actual finalizer, not the top level Dispose method

john-h-k avatar Mar 16 '19 10:03 john-h-k