4 ms·
> If you find yourself ever writing such _new function without the matching _free, you're doing it wrong. Agreed. This comes up with some frequency in cross-p
by ethomson 12y ago
> If you find yourself ever writing such _new function without the matching _free, you're doing it wrong.
Agreed. This comes up with some frequency in cross-platform code where somebody coming from Unix (like myself) assumes that there is one `malloc` and it corresponds to one `free`. On Windows, this is not true - when a module is built as debug, the debugging allocators are used which instrument for failures like double-free. So if your debug EXE links a release DLL and tries to `free` something that the DLL has `malloc`ed, your program will quickly abort.