4 ms·
As for C++, memory is not the only resource you can leak. When you leak, then you leak objects with it, and they can hold on to other resources that you might w
by leni536 4y ago
As for C++, memory is not the only resource you can leak. When you leak, then you leak objects with it, and they can hold on to other resources that you might want to clean deterministically.
Having said that nothing stops you from replacing the global allocation functions, so that deallocation is noop. But your program, and especially libraries should still match up malloc/free, new/delete and allocate/deallocate.
Also your default malloc probably does a bunch of bookkeeping that is eventually only used by free. Once you decide that you won't call free or use a noop free, then there are potentially better candidate implementations for malloc as well.