1 | tar –xzvf DrMemory-Linux-1.4.6-2.tar.gz |
1 | drmemory.pl ./t |
1 2 3 4 5 6 7 8 9 10 11 | 1: int main() 2: { 3: char *ptr; 4: int i; 5: for(i=0;i<100;i++) 6: { 7: ptr=(char*)malloc(i); 8: if(i%2) free(ptr); 9: } 10: return 0; 11: } |
1 2 3 4 5 6 7 8 9 10 11 12 13 | -bash-3.2$ gcc -m32 -o t t1.c -g -bash-3.2$ drmemory.pl ./t -bash-3.2$ ~~Dr.M~~ ~~Dr.M~~ ERRORS FOUND: ~~Dr.M~~ 0 unique, 0 total unaddressable access(es) ~~Dr.M~~ 0 unique, 0 total uninitialized access(es) ~~Dr.M~~ 0 unique, 0 total invalid heap argument(s) ~~Dr.M~~ 0 unique, 0 total warning(s) ~~Dr.M~~ 1 unique, 50 total, 0 byte(s) of leak(s) ~~Dr.M~~ 0 unique, 0 total, 0 byte(s) of possible leak(s) ~~Dr.M~~ ERRORS IGNORED: ~~Dr.M~~ 0 still-reachable allocation(s) ~~Dr.M~~ Details: /home/…/logs/DrMemory-t.15086.000/results.txt |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |