by jcelerier · 6y ago · 0 comments
that's why you do `auto array = std::make_unique<int[]>(n);` (or `auto array = std::make_unique_default_init<int[]>(n);` if you don't believe in your compiler's ability to optimize redundant writes)
Also, this "memory leak" is only an issue on pre-1990 operating systems as "current" operating systems have no trouble reclaiming unfreed memory - you loose exactly the same amount of memory in both cases : zero.
So no, don't litter noexcept everywhere, especially for that, this article just does not make sense.
Not just that, the OS is faster to reclaim the unfreed memory than if the program was cleaning it up.