My application needs to free a very large hash table, and it is incredibly slow in debug mode, so slow that I can not realistically work with it…but in release mode I have no debug symbols at all..
I need to debug the executable and understand I should be able to get it to link with release versions of the crt libraries.
I have done this by changing my “code generation” options to use “multithreaded dll” rather than “multithreaded debug dll”, however when I put a breakpoint in my hash table free routine and follow it through to the actual free call, it is using a function in a debug dll.
Anything else I can try? Is it a better option to work with the release configuration and try and get that to generate symbols for the stuff I actually need to debug?
(vs 2010 btw)
You can have debug symbols despite using release CRT and having all the optimizations turned-on. In fact this is what Visual C++ defaults to in Release configuration (see the Project Properties / Configuration Properties / C/C++ / General / Debug Information Format; and Linker / Debugging / Generate Debug Info). Please note that optimized code might be harder to debug – order of instructions may be changed and some pieces may be optimized-away entirely, causing some unexpected behavior when stepping through the code.
BTW, to turn-off the debug CRT, it is not enough to just change “Multi-threaded Debug DLL (/MDd)” to “Multi-threaded DLL (/MD)”, you also need to remove
_DEBUGfrom Preprocessor Definitions.That being said, the slowness you are experiencing may not be the consequence of your program at all – this may a debugger artifact (i.e. the slowness of reading large data structures for the purpose of displaying them in debugger UI). Please try running your program (Debug or Release configuration – it does not matter much) outside debugger and see if this makes a difference.
If so, and you can’t make your hash table smaller just for the purpose of debugging, you’ll have to either resort to “printf debugging” (i.e. manually insert diagnostics) or possibly try the remote debugging.