Project

General

Profile

Howtos - Monitor memory leaks

  1. Uncomment # DEFINES += ENABLE_NVWA in application/Core/Core.pro or application/Core/GUI.pro to activate monitoring.
  2. Rebuild the Core or the GUI.
  3. Run with the debugger attached (F5).
  4. When you want to check the memory leaks type quit in the console.

The output should be like this:

quit
Leaked object at 028E3D30 (size 24, 00418418)
Leaked object at 028E5B60 (size 24, 004183CC)
Leaked object at 028E6148 (size 24, 004183CC)
Leaked object at 028E9B08 (size 24, 004183CC)
Leaked object at 028E8F98 (size 24, 00418418)
Leaked object at 028E6798 (size 24, 00418418)
Leaked object at 028E9078 (size 24, 00418418)
Leaked object at 028E9630 (size 14, /mingw/src/gccbf/mingw32/libstdc++-v3/include/bits/basic_string.tcc:587)
Leaked object at 028E6F00 (size 24, 00418418)
Leaked object at 028E6F70 (size 24, 00418418)
Leaked object at 028E6FE0 (size 24, 00418418)
Leaked object at 028E7BE0 (size 48, 0041D57E)
Leaked object at 028E7C68 (size 48, 0041D692)
Leaked object at 028E7CF0 (size 48, 0041D692)
Leaked object at 028E7D78 (size 48, 0041D636)
Leaked object at 028E7E00 (size 48, 0041D5DA)
Leaked object at 028E6400 (size 24, 00418418)
Leaked object at 028EE788 (size 24, 00418418)
Leaked object at 028EE7F8 (size 24, /mingw/src/gccbf/mingw32/libstdc++-v3/include/bits/basic_string.tcc:587)
Leaked object at 028EE868 (size 40, E:\projects\D-LAN\application\Core/main.cpp:43)
Leaked object at 028EB400 (size 8, E:\projects\D-LAN\application\Core/../Libs/qtservice/src/qtservice.h:183)
*** 21 leaks found
delete: freed 028EE7F8 (size 24, 590 bytes still allocated)
delete: freed 028EE788 (size 24, 566 bytes still allocated)
delete: freed 028E6148 (size 24, 542 bytes still allocated)
delete: freed 028E6400 (size 24, 518 bytes still allocated)
delete: freed 028E9B08 (size 24, 494 bytes still allocated)
delete: freed 028E5B60 (size 24, 470 bytes still allocated)
delete: freed 028E7E00 (size 48, 422 bytes still allocated)
delete: freed 028E7D78 (size 48, 374 bytes still allocated)
delete: freed 028E7CF0 (size 48, 326 bytes still allocated)
delete: freed 028E7C68 (size 48, 278 bytes still allocated)
delete: freed 028E7BE0 (size 48, 230 bytes still allocated)
delete: freed 028E6FE0 (size 24, 206 bytes still allocated)
delete: freed 028E6F70 (size 24, 182 bytes still allocated)
delete: freed 028E6F00 (size 24, 158 bytes still allocated)
delete: freed 028E9630 (size 14, 144 bytes still allocated)
delete: freed 028E9078 (size 24, 120 bytes still allocated)
delete: freed 028E6798 (size 24, 96 bytes still allocated)
delete: freed 028E8F98 (size 24, 72 bytes still allocated)
delete: freed 028E3D30 (size 24, 48 bytes still allocated)
Press <RETURN> to close this window...

For some leaks the file and the line are not displayed because the code doesn't contain any debug information, a lot of the leaks shown above come from static variables from the Protocol Buffer library. The leak from main.cpp:43 is just a test, this line has been added: int* test = new int[10];