
{"id":14246,"date":"2013-09-21T17:38:33","date_gmt":"2013-09-21T17:38:33","guid":{"rendered":"http:\/\/www.beautifulwork.org\/?p=14246"},"modified":"2013-09-21T17:38:33","modified_gmt":"2013-09-21T17:38:33","slug":"detecting-memory-leaks-leak-ive","status":"publish","type":"post","link":"https:\/\/www.trueangle.org\/index.php\/2013\/09\/21\/detecting-memory-leaks-leak-ive\/","title":{"rendered":"Detecting Memory Leaks  (leak: + ive)"},"content":{"rendered":"<h4><u>commandline session<\/u><\/h4>\n<pre>\n$gcc -g leak.c\n$valgrind --tool=memcheck --leak-check=full .\/a.out\n==4353== Memcheck, a memory error detector\n==4353== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.\n==4353== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info\n==4353== Command: .\/a.out\n==4353==\n==4353==\n==4353== HEAP SUMMARY:\n==4353==     in use at exit: 100 bytes in 1 blocks\n==4353==   total heap usage: 1 allocs, 0 frees, 100 bytes allocated\n==4353==\n==4353== 100 bytes in 1 blocks are definitely lost in loss record 1 of 1\n==4353==    at 0x4C2BDEB: malloc (vg_replace_malloc.c:270)\n==4353==    by 0x40050D: main (leak.c:4)\n==4353==\n==4353== LEAK SUMMARY:\n==4353==    definitely lost: 100 bytes in 1 blocks\n==4353==    indirectly lost: 0 bytes in 0 blocks\n==4353==      possibly lost: 0 bytes in 0 blocks\n==4353==    still reachable: 0 bytes in 0 blocks\n==4353==         suppressed: 0 bytes in 0 blocks\n==4353==\n==4353== For counts of detected and suppressed errors, rerun with: -v\n==4353== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 2 from 2)\n$cat leak.c\n#include \nint main()\n{\n  char *x = (char*) malloc(100); \/\/Mem Leak!\n  return 0;\n}\n$\n\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>commandline session $gcc -g leak.c $valgrind &#8211;tool=memcheck &#8211;leak-check=full .\/a.out ==4353== Memcheck, a memory error detector ==4353== Copyright (C) 2002-2012, and GNU GPL&#8217;d, by Julian Seward et al. ==4353== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info ==4353== Command: .\/a.out ==4353== ==4353== ==4353== HEAP SUMMARY: ==4353== in use at exit: 100 bytes in 1 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.trueangle.org\/index.php\/2013\/09\/21\/detecting-memory-leaks-leak-ive\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Detecting Memory Leaks  (leak: + ive)&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[83],"tags":[389,1014,1108,1587],"_links":{"self":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/14246"}],"collection":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/comments?post=14246"}],"version-history":[{"count":0,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/14246\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/media?parent=14246"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/categories?post=14246"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/tags?post=14246"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}