GC + malloc/free = deadlock
Steven Schveighoffer
schveiguy at yahoo.com
Mon Apr 23 06:07:19 PDT 2012
On Mon, 23 Apr 2012 08:36:59 -0400, Kapps <opantm2+spam at gmail.com> wrote:
> On Monday, 23 April 2012 at 12:11:19 UTC, Benjamin Thaut wrote:
>>
>> If what you are saying is true, the deadlock must happen somewhere
>> else. This was kind of a assumption because the deadlock happend after
>> I added all the malloc / free calls. Because all the threads are
>> stopped when this happens I can't really debug this, because the Visual
>> Studio debugger tells me that it can not debug any thread but the one
>> that is currently running the GC.
>>
>> Kind Regards
>> Ingrater
>
> Are these threads created by core.thread.Thread, or are they created
> through different means such as native OS calls or a C api? If the
> latter, you have to register them with the runtime (I think it was
> something like Thread.attachThis), otherwise issues like this will
> happen.
No. Dtor calls should all be done while all threads are running. The
portion of the GC collection cycle which requires the world to be stopped
should not be doing any locking/unlocking in arbitrary C libs. If it is,
it's a bug.
-Steve
More information about the Digitalmars-d
mailing list