Home » U++ TheIDE » U++ TheIDE: Compiling, Linking, Debugging of your packages » Getting "heap leaks detected!" error messages on program exit. How to debug it?
Re: Getting "heap leaks detected!" error messages on program exit. How to debug it? [message #3995 is a reply to message #3986] |
Thu, 13 July 2006 22:44   |
battika
Messages: 4 Registered: July 2006 Location: Budapest, Hungary
|
Junior Member |
|
|
Hi Mirek,
First of all, thank you for your prompt and detailed answer. I hope you're still not running out of patience as I have some more comments.
Quote: | Now if heap leak manifests when connecting to external library, it is even more puzzling... (have you any 'new' in your code?)
|
Actually I started off with a "core console project". Included the Postgres library header files and added the library to the linker. Now if I comment out *everything* so only the CONSOLE_APP_MAIN section remains with the #include statement and attempt to run the program I get the same error message. So to answer your question I don't have any new()'s in my code since I don't have a code
Quote: | Anyway, for U++ based code, I usually start with looking at log file, which dumps all leaks. Quite often you can tell what the leak is just examining it.
|
Thank you for the tip. Again, sorry for the question but can you tell me where the log is normally located (Linux)?
Quote: | If that does not help, there is one ugly hack in heap code - you can add "memory-watch" into your APP_MAIN to catch the allocation that returns the address the leaks. (see Core/dbgheap.cpp for details - you place breakpoint there to catch). That of course helps only as long as leaking allocation for the specific address is the first one...
|
Cool, I will do that.
Quote: | Then of course, if everything else fails, I usually start to "minimize" code, removing part after part until leak goes away (then the bug is in the part I removed).
|
My code is already minimized . Probably it's time to have a look at the third-party header files.
Thanks a lot for your help again.
|
|
|
Goto Forum:
Current Time: Mon Jul 07 03:35:06 CEST 2025
Total time taken to generate the page: 0.03651 seconds
|