When I want to use dmalloc-5.5.2 to check memory leak on cross platform. I include dmalloc.h
, compile it by mips-gcc-4.3 and link it with ./libdmalldm.a
. The app work normally and the memory run out at the end. But show log like that:
1451616386: 4539: not freed: '0x6af408|s1' (560 bytes) from 'data.c:808'
1451616386: 4539: not freed: '0x6af808|s1' (560 bytes) from 'data.c:808'
1451616386: 4539: not freed: '0x6af408|s1' (560 bytes) from 'data.c:808'
1451616386: 4539: not freed: '0x6af808|s1' (560 bytes) from 'data.c:808'
1451616386: 4539: not freed: '0x6afc08|s1' (560 bytes) from 'data.c:808'
1451616386: 4539: not freed: '0x6b0008|s1' (2048 bytes) from 'unknown'
1451616386: 4539: not freed: '0x6b1008|s1' (2048 bytes) from 'unknown'
1451616386: 4539: not freed: '0x6b2008|s1' (2048 bytes) from 'unknown'
1451616386: 4539: not freed: '0x6b3008|s1' (2048 bytes) from 'unknown'
1451616386: 4539: not freed: '0x6b4008|s5' (2048 bytes) from 'unknown'
1451616386: 4539: not freed: '0x6b5008|s1' (2048 bytes) from 'unknown'
1451616386: 4539: not freed: '0x6b7008|s1' (2048 bytes) from 'unknown'
1451616386: 4539: not freed: '0x6b8008|s1' (2048 bytes) from 'unknown'
1451616386: 4539: not freed: '0x6b9008|s1' (2048 bytes) from 'unknown'
1451616386: 4539: not freed: '0x6ba008|s1' (2048 bytes) from 'unknown'
1451616386: 4539: not freed: '0x6bb008|s1' (2048 bytes) from 'unknown'
1451616386: 4539: not freed: '0x6bc008|s1' (2048 bytes) from 'unknown'
1451616386: 4539: not freed: '0x6be008|s1' (2048 bytes) from 'unknown'
1451616386: 4539: not freed: '0x6bf008|s1' (2048 bytes) from 'unknown'
1451616386: 4539: not freed: '0x6c0008|s1' (2048 bytes) from 'unknown'
1451616386: 4539: not freed: '0x6c1008|s1' (2048 bytes) from 'unknown'
1451616386: 4539: not freed: '0x6c2008|s1' (2048 bytes) from 'unknown'
1451616386: 4539: not freed: '0x6c3008|s1' (2048 bytes) from 'unknown'
1451616386: 4539: not freed: '0x6c4008|s1' (2048 bytes) from 'unknown'
1451616386: 4539: not freed: '0x6c5008|s1' (2048 bytes) from 'unknown'
1451616386: 4539: not freed: '0x6c6008|s1' (2048 bytes) from 'unknown'
1451616386: 4539: not freed: '0x6c7008|s1' (2048 bytes) from 'unknown'
1451616386: 4539: not freed: '0x6c8008|s5' (2048 bytes) from 'unknown'
1451616386: 4539: not freed: '0x6c9008|s1' (2048 bytes) from 'unknown'
1451616386: 4539: not freed: '0x6ca008|s1' (2048 bytes) from 'unknown'
1451616386: 4539: not freed: '0x6cb008|s1' (2048 bytes) from 'unknown'
1451616386: 4539: not freed: '0x6cc008|s1' (2048 bytes) from 'unknown'
1451616386: 4539: not freed: '0x6cd008|s1' (2048 bytes) from 'unknown'
1451616386: 4539: not freed: '0x6ce008|s1' (2048 bytes) from 'unknown'
1451616386: 4539: not freed: '0x6cf008|s1' (2048 bytes) from 'unknown'
1451616386: 4539: not freed: '0x6d0008|s1' (2048 bytes) from 'unknown'
1451616386: 4539: not freed: '0x6d1008|s1' (2048 bytes) from 'unknown'
1451616386: 4539: not freed: '0x6d2008|s1' (2048 bytes) from 'unknown'
1451616386: 4539: not freed: '0x6d3008|s1' (2048 bytes) from 'unknown'
I think that the place of unknown is where memory leak. But i don't know why dmalloc can't record the file and line where memory allocate. I read the document about dmalloc. I find that:
Often, you may allocate memory in via strdup() or another routine, so the logfile listing where in the strdup routine the memory was allocated does not help locate the true source of the memory leak - the routine that called strdup. Without a mechanism to trace the calling stack, there is no way for the library to see who the caller of the caller (so to speak) was.
But in dmalloc.h, still exist that:
dmalloc_strndup(__FILE__, __LINE__, (str), -1, 0)
Does the "unknown" information have relationship with strdup
.So my question is that why the dmalloc print the "unknown"?