First of all, sorry for digging up such an old thread, but I figured it was better to continue this one than to make a new one.
I'm trying to implement memory leak detection in my debug exe and for that I'm using the memory leak detector linked to in the original poster's post. However, I don't get any ouput. I'm guessing this is because my application is a GUI and I have no console window.
I did some simple tests, like adding a "cout << "Test";" line to my app and if I run it like this from the command prompt: "testapp.exe > output.txt", it works just fine, console output gets written to output.txt upon exit. So, after thinking about complaining here for help I dug a little deeper
.
First, I tried changing line 149 of debug_new.h to:
: _M_file(file), _M_line(line) { freopen("file_of_choice.txt", "w", new_output_fp); }
: _M_file(file), _M_line(line) { freopen("file_of_choice.txt", "w", new_output_fp); }
To copy to clipboard, switch view to plain text mode
But, for some reason that didn't quite work. In case anyone knows why, feel free to let me know. I even added a cout test line in the constructor, but it doesn't seem to do anything, pretty weird.
The simple solution is to edit line 281 of debug_new.cpp and change "stderr" to "stdout", so you can redirect the output to a file by simple calling your program from console with program.exe > outputfile.txt.
If anyone knows a more graceful solution, let me know.
Ok, this is newbie stuff, but still, it might save someone some time.
Bookmarks