Memory leak C++ May 29, 2023 by Tarik Use return 0; instead of exit(0); at the end of main. The use of exit circumvents the execution of the destructors.