Program crash: GC destroys an object unexpectedly
eugene
dee0xeed at gmail.com
Tue Sep 14 16:15:20 UTC 2021
On Tuesday, 14 September 2021 at 16:07:00 UTC, jfondren wrote:
> No. And when was the first one?
here:
On Monday, 13 September 2021 at 18:45:22 UTC, jfondren wrote:
> auto p = cast(EpollEvent*) pureMalloc(EpollEvent.sizeof);
What? Allocate struct epoll_event on the heap?
It is a feeble joke ;)
```c
static int ecap__add(int fd, void *dptr)
{
struct epoll_event waitfor = {0};
int flags, r;
waitfor.data.ptr = dptr;
r = epoll_ctl(epfd, EPOLL_CTL_ADD, fd, &waitfor);
if (-1 == r) {
```
All fd's (sockets, timers etc) are added the same way
and corresponding EventSources are not destroyed by GC.
More information about the Digitalmars-d-learn
mailing list