[Mono-list] gc handles not thread safe?

Rodrigo Kumpera kumpera at gmail.com
Thu Oct 17 03:20:16 UTC 2013


GC Handles are thread safe as they are used all the time by Xamarin's
products.

The best line of approach here is to file a bug report with a test case,
that's how you get a possible mono bug fixed.


On Wed, Oct 16, 2013 at 10:56 PM, Chris Ochs <chris at ochsnet.com> wrote:

> I'm embedding mono in a java app and when using gchandles it's obvious
> that memory is getting stomped on somehow.  When I don't use gc handles, or
> just use gc handles within a single thread, everything is fine.
>
> The same gc handle is never accessed concurrently from different threads,
> although I do pass them around to different threads.
>
> Reading/writing memory streams triggers the problem regularly, it usually
> segfaults in BlockCopy with various errors about the stream not containing
> the expected data, or sometimes division by zero.
>
> I'm fairly sure the code that handles threading is not at fault, I'm using
> Akka which has a well established concurrency model I don't explicitly
> create any threads myself.
>
> FYI I see this in mono 2 and the latest mono 3 from master.
>
> Is there another technique I can use to keep a MonoObject around and keep
> the gc from collecting it without using gc handles?   I was thinking of
> just having a thread safe dictionary in C# that keeps references to these
> objects, and just make all my calls into managed code via static methods
> that can get the object and call methods on it in C#.
>
> Chris
>
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-list/attachments/20131016/6837f389/attachment.html>


More information about the Mono-list mailing list