Valgrind is telling me I have error and possible memory leak in this simple C program -
this question has answer here:
- valgrind reports errors simple c program 3 answers
the challenge clear valgrind errors before going on next lesson, don't know what's wrong program. want know what's wrong before going on. thanks, appreciate help.
#include <stdio.h> int main() { int age = 10; int height = 72; printf("i %d years old.\n", age); printf("i %d inches tall.\n", height); return 0; }
here's valgrind report:
==41714== memcheck, memory error detector ==41714== copyright (c) 2002-2013, , gnu gpl'd, julian seward et al. ==41714== using valgrind-3.11.0.svn , libvex; rerun -h copyright info ==41714== command: ./ex3 ==41714== ==41714== conditional jump or move depends on uninitialised value(s) ==41714== @ 0x1003fbc3f: _platform_memchr$variant$haswell (in /usr/lib/system/libsystem_platform.dylib) ==41714== 0x1001efbb6: __sfvwrite (in /usr/lib/system/libsystem_c.dylib) ==41714== 0x1001fa005: __vfprintf (in /usr/lib/system/libsystem_c.dylib) ==41714== 0x10021f9ce: __v2printf (in /usr/lib/system/libsystem_c.dylib) ==41714== 0x10021fca0: __xvprintf (in /usr/lib/system/libsystem_c.dylib) ==41714== 0x1001f5b91: vfprintf_l (in /usr/lib/system/libsystem_c.dylib) ==41714== 0x1001f39f7: printf (in /usr/lib/system/libsystem_c.dylib) ==41714== 0x100000f4d: main (ex3.c:8) ==41714== 10 years old. 72 inches tall. ==41714== ==41714== heap summary: ==41714== in use @ exit: 38,816 bytes in 426 blocks ==41714== total heap usage: 507 allocs, 81 frees, 44,960 bytes allocated ==41714== ==41714== leak summary: ==41714== lost: 0 bytes in 0 blocks ==41714== indirectly lost: 0 bytes in 0 blocks ==41714== possibly lost: 0 bytes in 0 blocks ==41714== still reachable: 4,096 bytes in 1 blocks ==41714== suppressed: 34,720 bytes in 425 blocks ==41714== rerun --leak-check=full see details of leaked memory ==41714== ==41714== counts of detected , suppressed errors, rerun with: -v ==41714== use --track-origins=yes see uninitialised values come ==41714== error summary: 1 errors 1 contexts (suppressed: 0 0)
there no memory issues. never malloc or free anything, @ point memory handled without being involved. must issue valgrind. if using osx perhaps try on machine linux if have 1 available.
Comments
Post a Comment