Thread overview | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
April 20, 2016 Compiling with -profile=gc makes program crash - why? | ||||
---|---|---|---|---|
| ||||
I'm trying to use DMD option "-profile=gc". With this option, the following simple program crashes with 2.071.0 down to 2.069.0 but still works on 2.068.2. The command line is "dmd -g -profile=gc prfail1.d" on Windows (compiled to 32-bit by default). -----prfail1.d----- import std.concurrency; void someWork () {auto x = [1];} void main () {spawn (&someWork);} ----- The crash happens almost always, >90% of runs of the compiled program. Here's the error output: ----- object.Error@(0): Access Violation ---------------- 0x00409651 in nothrow int rt.profilegc._staticDtor407().__foreachbody2(ref immutable(char)[], ref rt.profilegc.Entry) 0x00409986 in void rt.profilegc.__moddtor() 0x00427444 in __threadstartex 0x77869ED2 in RtlInitializeExceptionChain 0x77869EA5 in RtlInitializeExceptionChain ----- With added "-m64", it just crashes and does not print anything. Am I doing something wrong, or is it a 2.069 regression? Interestingly, a modified version does not crash: -----prfail2.d----- import std.concurrency; void someWork () {auto x = [1];} void main () {spawn (&someWork); someWork ();} ----- I was curious if this guarantees that the spawned thread finishes before the main thread, but the third example, also crashing, seems to contradict that: -----prfail3.d----- import std.concurrency; void someWork () {auto x = [1];} void main () { spawnLinked (&someWork); try {receive ((int) {});} catch (LinkTerminated o) {} } ----- Ivan Kazmenko. |
April 20, 2016 Re: Compiling with -profile=gc makes program crash - why? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ivan Kazmenko | On Wednesday, 20 April 2016 at 22:27:36 UTC, Ivan Kazmenko wrote:
> I'm trying to use DMD option "-profile=gc". With this option, the following simple program crashes with 2.071.0 down to 2.069.0 but still works on 2.068.2. The command line is "dmd -g -profile=gc prfail1.d" on Windows (compiled to 32-bit by default).
Ouch, meant to post to D.learn. Sorry!
Well, perhaps no point in reposting now.
|
April 21, 2016 Re: Compiling with -profile=gc makes program crash - why? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ivan Kazmenko | On Wednesday, 20 April 2016 at 22:31:31 UTC, Ivan Kazmenko wrote:
> On Wednesday, 20 April 2016 at 22:27:36 UTC, Ivan Kazmenko wrote:
>> I'm trying to use DMD option "-profile=gc". With this option, the following simple program crashes with 2.071.0 down to 2.069.0 but still works on 2.068.2. The command line is "dmd -g -profile=gc prfail1.d" on Windows (compiled to 32-bit by default).
>
> Ouch, meant to post to D.learn. Sorry!
>
> Well, perhaps no point in reposting now.
You are using "spawn". So it is a multithreaded program. -profile=gc doesn't work with multithreadd programs. Always creates problems.
|
April 21, 2016 Re: Compiling with -profile=gc makes program crash - why? | ||||
---|---|---|---|---|
| ||||
Posted in reply to tcak | On Thursday, 21 April 2016 at 09:23:26 UTC, tcak wrote: >> I'm trying to use DMD option "-profile=gc". > You are using "spawn". So it is a multithreaded program. -profile=gc doesn't work with multithreadd programs. Always creates problems. Humm, when I searched whether it should work, I only found a reassuring post by Walter[1] almost a year ago. The issue tracker does not seem to contain an entry either. Perhaps I should create one, then. [1] http://forum.dlang.org/post/mia2kf$djb$1@digitalmars.com |
April 21, 2016 Re: Compiling with -profile=gc makes program crash - why? | ||||
---|---|---|---|---|
| ||||
Posted in reply to tcak | On Thursday, 21 April 2016 at 09:23:26 UTC, tcak wrote: > > You are using "spawn". So it is a multithreaded program. -profile=gc doesn't work with multithreadd programs. Always creates problems. Then it would probably help if that is mentioned on this page somewhere. https://dlang.org/dmd-windows.html |
April 21, 2016 Re: Compiling with -profile=gc makes program crash - why? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ivan Kazmenko | On Thursday, 21 April 2016 at 10:57:12 UTC, Ivan Kazmenko wrote: > Humm, when I searched whether it should work, I only found a reassuring post by Walter[1] almost a year ago. The issue tracker does not seem to contain an entry either. Perhaps I should create one, then. > > [1] http://forum.dlang.org/post/mia2kf$djb$1@digitalmars.com Issue created: https://issues.dlang.org/show_bug.cgi?id=15947 |
April 21, 2016 Re: Compiling with -profile=gc makes program crash - why? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ivan Kazmenko | On 4/21/2016 8:47 AM, Ivan Kazmenko wrote:
> Issue created:
> https://issues.dlang.org/show_bug.cgi?id=15947
Thank you.
|
Copyright © 1999-2021 by the D Language Foundation