[Mono-dev] Mono 2.0 (arm): Reverse PInvoke can cause memory corruption?
Paolo Molaro
lupus at ximian.com
Fri Oct 10 16:49:26 EDT 2008
On 10/10/08 FirstName LastName wrote:
> I have a general question regarding GC. When the GC runs, does it
> stop all threads in the process, even those created in unmanaged.
Only the ones it knows about, but see below.
> I asking the following because I'm wondering what would happen if the
> GC collects and at the same time, a reverse pinvoke is done from a native
> thread (back to managed code)?
The fix I committed will register the thread with the GC before
the delegate is executed on that thread.
Note that you must not manipulate managed objects in threads that were
not known to the runtime (they are known when they where created by
mono, the main thread, the ones where reverse p/invoke delegates are
called and the ones registered explicitly).
Try setting GC_DONT_GC=1 and running the app to see the crashes are due
to the GC.
lupus
--
-----------------------------------------------------------------
lupus at debian.org debian/rules
lupus at ximian.com Monkeys do it better
More information about the Mono-devel-list
mailing list