I'd like to track down when and how much memory gets allocated in my program and print it out for debugging purposes under certain circumstances!
An excellent way to debug memory problems is to use an external monitor such as valgrind. This will hook into the memory allocation and deallocation of your program, and print out a report at the end of your program showing any allocations that you didn't deallocate. No modification or recompilation of your program is necessary with this method.
You could overload the new and delete operators. See this article.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With