digitalmars.D.learn - Gc collects trigger access violation exception
- mashomee (30/33) Feb 10 2017 Hi, everyone.
- mashomee (2/2) Feb 11 2017 problem solved now.
- Nicholas Wilson (4/8) Feb 12 2017 It's great that you're found a workaround. If you weren't doing
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!_D2gc4impl12conservative2gc14ConservativeGC6qallocMFNbkkxC8TypeInfoZS4co e6memory8BlkInfo_() + 0x6d bytes Dthen 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!
Feb 10 2017
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
Feb 12 2017