I have a go program that executes a WMI query then converts the data back into go-land data structures (using the method here). Every so often, go's GC comes along and nukes some seemingly random parts of memory to 0
s, causing horrible breakage.
I am trying to figure out what exactly is causing this problem, and the next step, I believe, is to understand what happens during the COM call. My current understanding is:
Is this about what happens? How does Windows choose that memory location such that it doesn't overwrite existing data?
Every COM object is reference counted with AddRef() and Release(). Perhaps you need an extra AddRef() to keep it around longer.
I see from the sample code that there are a lot of defered Release calls. This is fine because we want the objects released at the end of main. In your program you might want to put off Release even longer (but, I don't know go or exactly what defer does)