Thread overview | |||||
---|---|---|---|---|---|
|
February 11, 2017 Gc collects trigger access violation exception | ||||
---|---|---|---|---|
| ||||
Hi, everyone.
I have a thread running in Dll. But it always halts because of access violation exception when GC begins collecting.
This is the thread stack frame in vs2013.
>testSendSms.exe!_D4core6thread6Thread9isRunningMFNbNdZb() + 0x1 bytes D
>testSendSms.exe!_D2gc4impl12conservative2gc3Gcx10smallAllocMFNbhKkkZPv() + 0x2a6 bytes D testSendSms.exe!_D2gc4impl12conservative2gc14ConservativeGC6qallocMFNbkkxC8TypeInfoZS4core6memory8BlkInfo_() + 0x6d bytes D
then found these in core.thread.d
private bool suspend( Thread t ) nothrow
{
.........
version( Windows )
{
if( t.m_addr != GetCurrentThreadId() && SuspendThread( t.m_hndl ) == 0xFFFFFFFF )
{
if( !t.isRunning )
{
Thread.remove( t );
return false;
}
onThreadError( "Unable to suspend thread" );
}
.......
}
........
}
I think the problem is when GC detects if the threading is runnig, using core.thread.isRunning, the thread pointer is null.
When dll is loaded, it calls Runtime.initialize(), gc_setProxy(gc) as the wiki says, so I have no idea why this happened, and how to fix it. Could someone give me a hint ?
Thanks!
|
February 12, 2017 Re: Gc collects trigger access violation exception | ||||
---|---|---|---|---|
| ||||
Posted in reply to mashomee | problem solved now. Just not use gc_setProxy. |
February 12, 2017 Re: Gc collects trigger access violation exception | ||||
---|---|---|---|---|
| ||||
Posted in reply to mashomee | On Saturday, 11 February 2017 at 03:21:29 UTC, mashomee wrote: > Hi, everyone. > > I have a thread running in Dll. But it always halts because of access violation exception when GC begins collecting. > > [...] It's great that you're found a workaround. If you weren't doing something funky to trigger this, please file a bug report at http://issues.dlang.org |
Copyright © 1999-2021 by the D Language Foundation