Program crash: GC destroys an object unexpectedly
eugene
dee0xeed at gmail.com
Sun Sep 19 21:10:16 UTC 2021
On Sunday, 19 September 2021 at 20:12:45 UTC, eugene wrote:
> On Monday, 13 September 2021 at 17:54:43 UTC, eugene wrote:
>> full src is here
>> http://zed.karelia.ru/0/e/edsm-in-d-2021-09-10.tar.gz
>
> I've also made two simple examples, just in case
>
> - http://zed.karelia.ru/0/e/edsm-in-d-simple-example-1.tar.gz
> Program does nothing, just waits for ^c, does not crash upon
> SIGINT.
>
> Now, let's put some pressure on garbage collector
> - http://zed.karelia.ru/0/e/edsm-in-d-simple-example-2.tar.gz
I rearranged the code of main() like this:
```d
void main(string[] args) {
auto Main = new Main();
auto stopper = new Stopper();
Main.run();
stopper.run();
writeln(" === Hello, world! === ");
auto md = new MessageDispatcher();
md.loop();
writeln(" === Goodbye, world! === ");
}
```
And it works correctly! Miracles... :)
More information about the Digitalmars-d-learn
mailing list