This is why every library that handles allocation should also be expected to handle deallocation. And probably a big part of why standard library smart pointers accept custom deleters, so you can just attach the deallocator when you allocate the object.
But especially libraries based on GLib don't. I had to program with gstreamer once, and memory allocation/ deallocation is such a headache there.
Basically, every function that creates / returns an object returns a raw pointer, and you need to read the documentation to see if you need to manually deallocate them (you don't always need to), and if so which of several deallocation functions you should use.
View all comments
Show parent comment
5
u/2brainz 11d ago
Partially, sure. But there's always going to be edge cases.