Skip to content

Compilation with dmalloc heap checker

peclik edited this page Mar 21, 2011 · 3 revisions

DMALLOC:

  • checks access beyond boundaries of dynamically allocated memory blocks.
  • checks heap leaks (unallocated blocks on program exit)
  • logs every allocation-deallocation to the log file

To compile with DMALLOC:

  1. install dmalloc into directory named dmalloc at the level your LK8000 source directory is placed
    • a) download dmalloc-win32.zip and unpack it into directory, or
    • b) download dmalloc source codes and compile them yourself (don't forget set appropriate INTERNAL_MEMORY_SPACE)
  2. clean build (delete Bin/PC)
  3. call make TARGET=PC DMALLOC=y

DMALLOC is controlled by environment variables. See lk.bat in dmalloc-win32.zip for example.

Sample DMALLOC output:

1300723524: 12: *** alloc: at 'Common/Source/LKLanguage.cpp:579' for 12 bytes, got '0x700fc8|s1'
1300723524: 13: *** alloc: at 'Common/Source/LKLanguage.cpp:579' for 12 bytes, got '0x700fa8|s1'
1300723524: 1596: WARNING: tried to free(0) from 'Common/Source/xmlParser.cpp:1778'
1300723524: 1601: *** free: at 'Common/Source/xmlParser.cpp:1789' pnt '0x727988|s2': size 52, alloced at 'Common/Source/xmlParser.cpp:588'
1300723528: 1766:  not freed: '0x73b008|s1' (16200 bytes) from 'Common/Source/Geoid.cpp:45'
1300723528: 1766:  not freed: '0x727d48|s1' (34 bytes) from 'Common/Source/LKLanguage.cpp:579' 
1300723528: 1766:  total-size  count  source
1300723528: 1766:       97188    198  ra=0x52f2fd
1300723528: 1766:       32324   1256  Common/Source/LKLanguage.cpp:579
1300723528: 1766:       16200      1  Common/Source/Geoid.cpp:45
1300723528: 1766:          12      1  ra=0x51d4da
1300723528: 1766:      145724   1456  Total of 4
1300723528: 1766: ending time = 1300723528, elapsed since start = 0:00:04`
Clone this wiki locally