Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ TheIDE » U++ TheIDE: Compiling, Linking, Debugging of your packages » Heap memory leaks - how to debug the fastest way?[SOLVED]
Heap memory leaks - how to debug the fastest way?[SOLVED] [message #1757] Sat, 18 March 2006 00:02 Go to next message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
In my app buglog I have

Heap leaks detected:
MemoryWatch(0xDE2388);
MemoryWatch(0xDE23C8);
MemoryWatch(0xDE2448);
MemoryWatch(0xDE2488);

How to find the culprits the fastest way?

[Updated on: Sun, 19 March 2006 07:22]

Report message to a moderator

Re: Heap memory leaks - how to debug? [message #1759 is a reply to message #1757] Sat, 18 March 2006 00:59 Go to previous messageGo to next message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
and in log file I have:

ActivateWnd class TopWindow : 0x12fdb0(hwnd 0x4b01fe)
About to set focus: class TopWindow : 0x12fdb0(hwnd 0x4b01fe)
Do SyncCaret focusCtrl: class TopWindow : 0x12fdb0(hwnd 0x4b01fe), caretCtrl: NULL
Focus: class TopWindow : 0x12fdb0(hwnd 0x4b01fe) FocusWnd:class TopWindow : 0x12fdb0(hwnd 0x4b01fe)
KillFocusWnd class TopWindow : 0x12fdb0(hwnd 0x4b01fe)
DoDeactivate class TopWindow : 0x12fdb0(hwnd 0x4b01fe) in favor of NULL
LostFocus: class TopWindow
Do SyncCaret focusCtrl: NULL, caretCtrl: class TopWindow : 0x12fdb0(hwnd 0x4b01fe)
ActivateWnd class TopWindow : 0x12fdb0(hwnd 0x4b01fe)
About to set focus: class TopWindow : 0x12fdb0(hwnd 0x4b01fe)
Do SyncCaret focusCtrl: class TopWindow : 0x12fdb0(hwnd 0x4b01fe), caretCtrl: NULL
Ctrl::SetFocus class TopWindow
focusCtrlWnd class TopWindow : 0x12fdb0(hwnd 0x4b01fe)
Focus: class TopWindow : 0x12fdb0(hwnd 0x4b01fe) FocusWnd:class TopWindow : 0x12fdb0(hwnd 0x4b01fe)
KillFocusWnd class TopWindow : 0x12fdb0(hwnd 0x4b01fe)
DoDeactivate class TopWindow : 0x12fdb0(hwnd 0x4b01fe) in favor of NULL
LostFocus: class TopWindow
Do SyncCaret focusCtrl: NULL, caretCtrl: class TopWindow : 0x12fdb0(hwnd 0x4b01fe)
ActivateWnd class TopWindow : 0x12fdb0(hwnd 0x4b01fe)
About to set focus: class TopWindow : 0x12fdb0(hwnd 0x4b01fe)
Do SyncCaret focusCtrl: class TopWindow : 0x12fdb0(hwnd 0x4b01fe), caretCtrl: NULL
Ctrl::SetFocus class TopWindow
focusCtrlWnd class TopWindow : 0x12fdb0(hwnd 0x4b01fe)
Focus: class TopWindow : 0x12fdb0(hwnd 0x4b01fe) FocusWnd:class TopWindow : 0x12fdb0(hwnd 0x4b01fe)
KillFocusWnd class TopWindow : 0x12fdb0(hwnd 0x4b01fe)
DoDeactivate class TopWindow : 0x12fdb0(hwnd 0x4b01fe) in favor of NULL
LostFocus: class TopWindow
Do SyncCaret focusCtrl: NULL, caretCtrl: class TopWindow : 0x12fdb0(hwnd 0x4b01fe)
ActivateWnd class TopWindow : 0x12fdb0(hwnd 0x4b01fe)
About to set focus: class TopWindow : 0x12fdb0(hwnd 0x4b01fe)
Do SyncCaret focusCtrl: class TopWindow : 0x12fdb0(hwnd 0x4b01fe), caretCtrl: NULL
Ctrl::SetFocus class TopWindow
focusCtrlWnd class TopWindow : 0x12fdb0(hwnd 0x4b01fe)
Focus: class TopWindow : 0x12fdb0(hwnd 0x4b01fe) FocusWnd:class TopWindow : 0x12fdb0(hwnd 0x4b01fe)
Ctrl::ClickActivateWnd
LostFocus: class TopWindow
Do SyncCaret focusCtrl: NULL, caretCtrl: class TopWindow : 0x12fdb0(hwnd 0x4b01fe)
KillFocusWnd class TopWindow : 0x12fdb0(hwnd 0x4b01fe)
Memory at 0xDE2388, size 0x30 = 48
    +0 0x00DE2388 44 3A 5C 44 65 76 65 6C 5F 75 70 70 5C 6F 75 74     D:\Devel_upp\out
   +16 0x00DE2398 5C 4D 53 43 37 31 2E 44 65 62 75 67 5F 66 75 6C     \MSC71.Debug_ful
   +32 0x00DE23A8 6C 2E 47 75 69 5C 00 65 46 72 65 65 46 72 65 65     l.Gui\.eFreeFree
Memory at 0xDE23C8, size 0x28 = 40
    +0 0x00DE23C8 46 72 65 65 88 23 DE 00 46 72 65 65 46 72 65 65     Freeˆ#Þ.FreeFree
   +16 0x00DE23D8 46 72 65 65 26 00 00 00 2F 00 00 00 00 00 00 00     Free&.../.......
   +32 0x00DE23E8 00 00 00 00 46 72 65 65                             ....Free        
Memory at 0xDE2448, size 0x28 = 40
    +0 0x00DE2448 46 72 65 65 64 31 5F 63 6F 70 79 00 46 72 65 65     Freed1_copy.Free
   +16 0x00DE2458 46 72 65 65 07 00 00 00 0F 00 00 00 00 00 00 00     Free............
   +32 0x00DE2468 00 00 00 00 46 72 65 65                             ....Free        
Memory at 0xDE2488, size 0x28 = 40
    +0 0x00DE2488 46 72 65 65 64 31 5F 63 6F 70 79 2E 64 00 65 65     Freed1_copy.d.ee
   +16 0x00DE2498 46 72 65 65 09 00 00 00 0F 00 00 00 00 00 00 00     Free............
   +32 0x00DE24A8 00 00 00 00 46 72 65 65                             ....Free    


Re: Heap memory leaks - how to debug? [message #1773 is a reply to message #1757] Sat, 18 March 2006 11:54 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
fudadmin wrote on Fri, 17 March 2006 18:02

In my app buglog I have

Heap leaks detected:
MemoryWatch(0xDE2388);
MemoryWatch(0xDE23C8);
MemoryWatch(0xDE2448);
MemoryWatch(0xDE2488);

How to find the culprits the fastest way?


Well, there is the purpose for above format Smile

Put those MemoryWatch at the beginning of APP_MAIN, then place breakpoint at the line 79 of Core/heapdbg.cpp and start in debug mode...

Well, in fact, this does not help always (because the memory can be allocated and deallocated many times before being leaked), but usually it is a good idea to give it a try. If that fails, use traditional methods.... (usually, deactivate parts of the code until you spot the leak).

BTW, most memory leaks I have experienced recently were caused by missing virtual destructor.

Mirek
Re: Heap memory leaks - how to debug? [message #1781 is a reply to message #1773] Sat, 18 March 2006 21:26 Go to previous messageGo to next message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
luzr wrote on Sat, 18 March 2006 10:54

fudadmin wrote on Fri, 17 March 2006 18:02

In my app buglog I have

Heap leaks detected:
MemoryWatch(0xDE2388);
MemoryWatch(0xDE23C8);
MemoryWatch(0xDE2448);
MemoryWatch(0xDE2488);

How to find the culprits the fastest way?


Well, there is the purpose for above format Smile

Put those MemoryWatch at the beginning of APP_MAIN, then place breakpoint at the line 79 of Core/heapdbg.cpp and start in debug mode...

Well, in fact, this does not help always (because the memory can be allocated and deallocated many times before being leaked), but usually it is a good idea to give it a try. If that fails, use traditional methods.... (usually, deactivate parts of the code until you spot the leak).

BTW, most memory leaks I have experienced recently were caused by missing virtual destructor.

Mirek



Thank you. That's very useful. I'll try. Meanwhile, I had found the culpripts using traditional ways. I'm pretty sure that was some name clashes with U++...
Re: Heap memory leaks - how to debug? [message #1783 is a reply to message #1781] Sat, 18 March 2006 21:40 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Quote:


I'm pretty sure that was some name clashes with U++...



Yes, I am afraid the time is coming to seriously reconsider namespaces...

Mirek
Re: Heap memory leaks - how to debug? [message #18850 is a reply to message #1781] Mon, 27 October 2008 21:48 Go to previous message
nixnixnix is currently offline  nixnixnix
Messages: 415
Registered: February 2007
Location: Kelowna, British Columbia
Senior Member
Hello,

So obviously heapdbg.cpp has changed somewhat since that was written. Which line do We need to add the breakpoint to now please?

Nick
Previous Topic: SVN 538 compile error
Next Topic: Crash with "all shared" output mode
Goto Forum:
  


Current Time: Sat Apr 20 04:12:49 CEST 2024

Total time taken to generate the page: 0.02194 seconds