App hangs, GC.collect() fixet it. Why?

Bastiaan Veelo Bastiaan at Veelo.net
Fri Jun 5 17:57:42 UTC 2020


I've been tracking down a hang in our pilot app. Using writeln, 
it appears to hang at newing a slice. After many hours of trying 
things, I discovered that program flow would continue past that 
point when I inserted a call to `GC.collect()` just before. Then 
it stalled again at a call to Win32 `SetMenu()`. Again, inserting 
`GC.collect()` before that made the problem go away.

This band-aid isn't going to scale in the long run. I feel I'm 
treating symptoms, and wonder what the cause is. Any ideas?

I know the GC is not disabled somehow because if I print 
`GC.profileStats()`, I see that there are collections even 
without my explicit calls to `GC.collect()`.

Thanks,

Bastiaan.


More information about the Digitalmars-d-learn mailing list