On Monday, 13 September 2021 at 17:18:30 UTC, eugene wrote:
I do not understand at all why GC considers those sg0 and sg1
as unreferenced.
And why old gdc (without -Os) and old ldc do not.
Conclusion:
There's nothing special about sg0 and sg1, except that they're
part of Stopper. The Stopper in main() is collected before the
end of main() because it's not used later in the function and
because there are apparently no other references to it that the
GC can find (because the only reference is hidden inside the
Linux epoll API).
More discussion:
https://forum.dlang.org/thread/siajpj$3p2$1...@digitalmars.com
http://dpldocs.info/this-week-in-d/Blog.Posted_2021_09_20.html
Misaligned pointers are one way to hide objects from the GC but
in this case they really weren't relevant. I just had a confused
idea of the epoll API, because I'd only ever used it with a
single static array that all epoll functions referenced,
similarly to poll(). But actually epoll copies the event
structures that you give it, and returns them on epoll_wait.
That's wild.