Anything wrong with spamming GC.KeepAlive(KeyboardHookPointer)?
Posted
by Alex
on Stack Overflow
See other posts from Stack Overflow
or by Alex
Published on 2010-04-12T00:15:24Z
Indexed on
2010/04/12
0:23 UTC
Read the original article
Hit count: 512
GC.KeepAlive()
References the specified object, which makes it ineligible for garbage collection from the start of the current routine to the point where this method is called.
Not really sure about what GC.KeepAlive does other than simply store a reference so the Garbage Collector doesn't collect the object. But does calling GC.KeepAlive() on an object permanently keep an object from being collected? Or do you have to re-call GC.KeepAlive() every so often (and if so, how often)? I want to keep my keyboard hook alive.
© Stack Overflow or respective owner