I am using a C bindings library (https://code.dlang.org/packages/xcb-d).

I am following through a tutorial that was written for the C library directly and just making the minor changes to make it work with D.

I ran into a problem. The library ends up giving me a struct pointer.

```
xcb_generic_event_t*    event;
event = xcb_wait_for_event (connection);
free (event);
```

The problem is the `free` function. It is not provided by the library but is part of the C standard library (in stdlib.h).

Do I need to call this function with my D code? I tried using the `core.memory.GC.free` function from the D standard library and it compiled and ran but that does not necessarily mean there are not memory leaks (it also ran with the line entirely removed).

Do I need to call the `free` function with my D code because I need to free memory that was allocated in C code?

Reply via email to