C valgrind: memory gets used up but it is not showing the what or why

Code:
userx@FreeBSD.net:~
$ valgrind --tool=memcheck mhsetroot
--17065:0:procself sysctll 1
userx@FreeBSD.net:~
$ valgrind --tool=memcheck --leak-check=yes mhsetroot
--30861:0:procself sysctll 1
userx@FreeBSD.net:~/Downloads/mhsetroot-2.0
$ valgrind --tool=memcheck --leak-check=yes ./mhsetroot -s -o /media/data/variety
--29306:0:procself sysctll 1

I'm not getting any output that I can even figure out to understand it. just that "procself sysctll 1" what does that mean???

----------- I changed the title becuase I figure out how to run this thing, so start on post #2 ---
 
Ar' Kin stupid... got be root to run this. so might as well post some valid output..

Code:
userx@FreeBSD.net:~/Downloads/mhsetroot-2.0
$ sudo valgrind --tool=memcheck --leak-check=yes ./mhsetroot -s -o /media/data/variety
==33823== Memcheck, a memory error detector
==33823== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==33823== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info
==33823== Command: ./mhsetroot -s -o /media/data/variety
==33823==
==33823== Conditional jump or move depends on uninitialised value(s)
==33823==    at 0x4BD5267: ??? (in /lib/libc.so.7)
==33823==    by 0x7FF000B7F: ???
==33823==    by 0x205AB8: ??? (in /usr/home/userx/Downloads/mhsetroot-2.0/mhsetroot)
==33823==    by 0x20311A: ??? (in /usr/home/userx/Downloads/mhsetroot-2.0/mhsetroot)
==33823==    by 0x4826FFF: ???
==33823==
==33823== Conditional jump or move depends on uninitialised value(s)
==33823==    at 0x4BC54F3: ??? (in /lib/libc.so.7)
==33823==    by 0x205B2B: ??? (in /usr/home/userx/Downloads/mhsetroot-2.0/mhsetroot)
==33823==    by 0x20311A: ??? (in /usr/home/userx/Downloads/mhsetroot-2.0/mhsetroot)
==33823==    by 0x4826FFF: ???
==33823==
Config File = /root/mhsetrootimagefile
Change Images time set at 60 seconds
==33823== Conditional jump or move depends on uninitialised value(s)
==33823==    at 0x4BD5267: ??? (in /lib/libc.so.7)
==33823==    by 0x7FF00013F: ???
==33823==    by 0x4AFC0D1: ??? (in /lib/libc.so.7)
==33823==    by 0x23: ???
==33823==    by 0x2038EA: ??? (in /usr/home/userx/Downloads/mhsetroot-2.0/mhsetroot)
==33823==    by 0x2039FD: ??? (in /usr/home/userx/Downloads/mhsetroot-2.0/mhsetroot)
==33823==    by 0x205F1D: ??? (in /usr/home/userx/Downloads/mhsetroot-2.0/mhsetroot)
==33823==    by 0x20311A: ??? (in /usr/home/userx/Downloads/mhsetroot-2.0/mhsetroot)
==33823==    by 0x4826FFF: ???
==33823==
==33823== Conditional jump or move depends on uninitialised value(s)
==33823==    at 0x4BD5267: ??? (in /lib/libc.so.7)
==33823==    by 0x7FEFFFCAF: ???
==33823==    by 0x4AFC0D1: ??? (in /lib/libc.so.7)
==33823==    by 0x27: ???
==33823==    by 0x2038EA: ??? (in /usr/home/userx/Downloads/mhsetroot-2.0/mhsetroot)
==33823==    by 0x2039FD: ??? (in /usr/home/userx/Downloads/mhsetroot-2.0/mhsetroot)
==33823==    by 0x2039FD: ??? (in /usr/home/userx/Downloads/mhsetroot-2.0/mhsetroot)
==33823==    by 0x205F1D: ??? (in /usr/home/userx/Downloads/mhsetroot-2.0/mhsetroot)
==33823==    by 0x20311A: ??? (in /usr/home/userx/Downloads/mhsetroot-2.0/mhsetroot)
==33823==    by 0x4826FFF: ???
==33823==
==33823== Conditional jump or move depends on uninitialised value(s)
==33823==    at 0x4BD5267: ??? (in /lib/libc.so.7)
==33823==    by 0x7FEFFFCAF: ???
==33823==    by 0x4AFC0D1: ??? (in /lib/libc.so.7)
==33823==    by 0x61: ???
==33823==    by 0x2038EA: ??? (in /usr/home/userx/Downloads/mhsetroot-2.0/mhsetroot)
==33823==    by 0x2039FD: ??? (in /usr/home/userx/Downloads/mhsetroot-2.0/mhsetroot)
==33823==    by 0x2039FD: ??? (in /usr/home/userx/Downloads/mhsetroot-2.0/mhsetroot)
==33823==    by 0x205F1D: ??? (in /usr/home/userx/Downloads/mhsetroot-2.0/mhsetroot)
==33823==    by 0x20311A: ??? (in /usr/home/userx/Downloads/mhsetroot-2.0/mhsetroot)
==33823==    by 0x4826FFF: ???
==33823==
==33823== Conditional jump or move depends on uninitialised value(s)
==33823==    at 0x4BD5267: ??? (in /lib/libc.so.7)
==33823==    by 0x7FF00013F: ???
==33823==    by 0x4AFC0D1: ??? (in /lib/libc.so.7)
==33823==    by 0x28: ???
==33823==    by 0x2038EA: ??? (in /usr/home/userx/Downloads/mhsetroot-2.0/mhsetroot)
==33823==    by 0x2039FD: ??? (in /usr/home/userx/Downloads/mhsetroot-2.0/mhsetroot)
==33823==    by 0x205F1D: ??? (in /usr/home/userx/Downloads/mhsetroot-2.0/mhsetroot)
==33823==    by 0x20311A: ??? (in /usr/home/userx/Downloads/mhsetroot-2.0/mhsetroot)
==33823==    by 0x4826FFF: ???
==33823==
==33823== Conditional jump or move depends on uninitialised value(s)
==33823==    at 0x4BD5267: ??? (in /lib/libc.so.7)
==33823==    by 0x7FEFFFCAF: ???
==33823==    by 0x4AFC0D1: ??? (in /lib/libc.so.7)
==33823==    by 0x32: ???
==33823==    by 0x2038EA: ??? (in /usr/home/userx/Downloads/mhsetroot-2.0/mhsetroot)
==33823==    by 0x2039FD: ??? (in /usr/home/userx/Downloads/mhsetroot-2.0/mhsetroot)
==33823==    by 0x2039FD: ??? (in /usr/home/userx/Downloads/mhsetroot-2.0/mhsetroot)
==33823==    by 0x205F1D: ??? (in /usr/home/userx/Downloads/mhsetroot-2.0/mhsetroot)
==33823==    by 0x20311A: ??? (in /usr/home/userx/Downloads/mhsetroot-2.0/mhsetroot)
==33823==    by 0x4826FFF: ???
==33823==
==33823== Conditional jump or move depends on uninitialised value(s)
==33823==    at 0x4BD5267: ??? (in /lib/libc.so.7)
==33823==    by 0x7FEFFFCAF: ???
==33823==    by 0x4AFC0D1: ??? (in /lib/libc.so.7)
==33823==    by 0x31: ???
==33823==    by 0x2038EA: ??? (in /usr/home/userx/Downloads/mhsetroot-2.0/mhsetroot)
==33823==    by 0x2039FD: ??? (in /usr/home/userx/Downloads/mhsetroot-2.0/mhsetroot)
==33823==    by 0x2039FD: ??? (in /usr/home/userx/Downloads/mhsetroot-2.0/mhsetroot)
==33823==    by 0x205F1D: ??? (in /usr/home/userx/Downloads/mhsetroot-2.0/mhsetroot)
==33823==    by 0x20311A: ??? (in /usr/home/userx/Downloads/mhsetroot-2.0/mhsetroot)
==33823==    by 0x4826FFF: ???
==33823==
==33823== Conditional jump or move depends on uninitialised value(s)
==33823==    at 0x4BD5267: ??? (in /lib/libc.so.7)
==33823==    by 0x7FEFFFCAF: ???
==33823==    by 0x4AFC0D1: ??? (in /lib/libc.so.7)
==33823==    by 0x6C: ???
==33823==    by 0x2038EA: ??? (in /usr/home/userx/Downloads/mhsetroot-2.0/mhsetroot)
==33823==    by 0x2039FD: ??? (in /usr/home/userx/Downloads/mhsetroot-2.0/mhsetroot)
==33823==    by 0x2039FD: ??? (in /usr/home/userx/Downloads/mhsetroot-2.0/mhsetroot)
==33823==    by 0x205F1D: ??? (in /usr/home/userx/Downloads/mhsetroot-2.0/mhsetroot)
==33823==    by 0x20311A: ??? (in /usr/home/userx/Downloads/mhsetroot-2.0/mhsetroot)
==33823==    by 0x4826FFF: ???
==33823==
filename /media/data/variety/wallhaven-papers/wallhaven-lq3l6q.jpg
==33823== Conditional jump or move depends on uninitialised value(s)
==33823==    at 0x4BD5267: ??? (in /lib/libc.so.7)
==33823==    by 0x7FF0004BF: ???
==33823==    by 0x4AFC0D1: ??? (in /lib/libc.so.7)
==33823==    by 0x24: ???
==33823==    by 0x4891D1B: ??? (in /usr/local/lib/libImlib2.so.1.5.1)
==33823==    by 0x488FFE2: ??? (in /usr/local/lib/libImlib2.so.1.5.1)
==33823==    by 0x488FCB6: ??? (in /usr/local/lib/libImlib2.so.1.5.1)
==33823==    by 0x487006C: ??? (in /usr/local/lib/libImlib2.so.1.5.1)
==33823==    by 0x2033B2: ??? (in /usr/home/userx/Downloads/mhsetroot-2.0/mhsetroot)
==33823==    by 0x205F2B: ??? (in /usr/home/userx/Downloads/mhsetroot-2.0/mhsetroot)
==33823==    by 0x20311A: ??? (in /usr/home/userx/Downloads/mhsetroot-2.0/mhsetroot)
==33823==    by 0x4826FFF: ???
==33823==
==33823== Conditional jump or move depends on uninitialised value(s)
==33823==    at 0x4BD5267: ??? (in /lib/libc.so.7)
==33823==    by 0x7FF0004BF: ???
==33823==    by 0x4AFC0D1: ??? (in /lib/libc.so.7)
==33823==    by 0x23: ???
==33823==    by 0x4891D1B: ??? (in /usr/local/lib/libImlib2.so.1.5.1)
==33823==    by 0x488FFE2: ??? (in /usr/local/lib/libImlib2.so.1.5.1)
==33823==    by 0x488FCB6: ??? (in /usr/local/lib/libImlib2.so.1.5.1)
==33823==    by 0x487006C: ??? (in /usr/local/lib/libImlib2.so.1.5.1)
==33823==    by 0x2033B2: ??? (in /usr/home/userx/Downloads/mhsetroot-2.0/mhsetroot)
==33823==    by 0x205F2B: ??? (in /usr/home/userx/Downloads/mhsetroot-2.0/mhsetroot)
==33823==    by 0x20311A: ??? (in /usr/home/userx/Downloads/mhsetroot-2.0/mhsetroot)
==33823==    by 0x4826FFF: ???
==33823==
==33823== Conditional jump or move depends on uninitialised value(s)
==33823==    at 0x4BD5267: ??? (in /lib/libc.so.7)
==33823==    by 0x7FF0004BF: ???
==33823==    by 0x4AFC0D1: ??? (in /lib/libc.so.7)
==33823==    by 0x22: ???
==33823==    by 0x4891D1B: ??? (in /usr/local/lib/libImlib2.so.1.5.1)
==33823==    by 0x488FFE2: ??? (in /usr/local/lib/libImlib2.so.1.5.1)
==33823==    by 0x488FCB6: ??? (in /usr/local/lib/libImlib2.so.1.5.1)
==33823==    by 0x487006C: ??? (in /usr/local/lib/libImlib2.so.1.5.1)
==33823==    by 0x2033B2: ??? (in /usr/home/userx/Downloads/mhsetroot-2.0/mhsetroot)
==33823==    by 0x205F2B: ??? (in /usr/home/userx/Downloads/mhsetroot-2.0/mhsetroot)
==33823==    by 0x20311A: ??? (in /usr/home/userx/Downloads/mhsetroot-2.0/mhsetroot)
==33823==    by 0x4826FFF: ???
==33823==
==33823== Conditional jump or move depends on uninitialised value(s)
==33823==    at 0x4BD5235: ??? (in /lib/libc.so.7)
==33823==    by 0x7FF00068F: ???
==33823==    by 0x4F38E1B: ??? (in /usr/local/lib/libxcb.so.1.1.0)
==33823==    by 0x49ABBDA: ??? (in /usr/local/lib/libX11.so.6.3.0)
==33823==    by 0x499AE83: ??? (in /usr/local/lib/libX11.so.6.3.0)
==33823==    by 0x204FE7: ??? (in /usr/home/userx/Downloads/mhsetroot-2.0/mhsetroot)
==33823==    by 0x205F54: ??? (in /usr/home/userx/Downloads/mhsetroot-2.0/mhsetroot)
==33823==    by 0x20311A: ??? (in /usr/home/userx/Downloads/mhsetroot-2.0/mhsetroot)
==33823==    by 0x4826FFF: ???
==33823==
==33823== Conditional jump or move depends on uninitialised value(s)
==33823==    at 0x4BD5267: ??? (in /lib/libc.so.7)
==33823==    by 0x7FF00068F: ???
==33823==    by 0x4F38E1B: ??? (in /usr/local/lib/libxcb.so.1.1.0)
==33823==    by 0x49ABBDA: ??? (in /usr/local/lib/libX11.so.6.3.0)
==33823==    by 0x499AE83: ??? (in /usr/local/lib/libX11.so.6.3.0)
==33823==    by 0x204FE7: ??? (in /usr/home/userx/Downloads/mhsetroot-2.0/mhsetroot)
==33823==    by 0x205F54: ??? (in /usr/home/userx/Downloads/mhsetroot-2.0/mhsetroot)
==33823==    by 0x20311A: ??? (in /usr/home/userx/Downloads/mhsetroot-2.0/mhsetroot)
==33823==    by 0x4826FFF: ???
==33823==
==33823== Conditional jump or move depends on uninitialised value(s)
==33823==    at 0x4BD5267: ??? (in /lib/libc.so.7)
==33823==    by 0x7FF00059F: ???
==33823==    by 0x4F39574: ??? (in /usr/local/lib/libxcb.so.1.1.0)
==33823==    by 0x4F38F3D: ??? (in /usr/local/lib/libxcb.so.1.1.0)
==33823==    by 0x49ABBDA: ??? (in /usr/local/lib/libX11.so.6.3.0)
==33823==    by 0x499AE83: ??? (in /usr/local/lib/libX11.so.6.3.0)
==33823==    by 0x204FE7: ??? (in /usr/home/userx/Downloads/mhsetroot-2.0/mhsetroot)
==33823==    by 0x205F54: ??? (in /usr/home/userx/Downloads/mhsetroot-2.0/mhsetroot)
==33823==    by 0x20311A: ??? (in /usr/home/userx/Downloads/mhsetroot-2.0/mhsetroot)
==33823==    by 0x4826FFF: ???
==33823==
filename /media/data/variety/wallhaven-papers/wallhaven-w8y7xx.jpg
filename /media/data/variety/wallhaven-papers/wallhaven-73g28y.jpg
when I don't run that and just run the program on user side, not sudo.
each time it changes the image the total free memory gets smaller.
Code:
userx@FreeBSD.net:~
$ top -d1 | head -n 6
last pid:  7144;  load averages:  0.23,  0.24,  0.20  up 0+00:49:23    08:36:07
61 processes:  1 running, 59 sleeping, 1 zombie
CPU:  5.4% user,  0.0% nice,  1.4% system,  0.3% interrupt, 92.9% idle
Mem: 2288M Active, 215M Inact, 77M Laundry, 1409M Wired, 528M Buf, 3702M Free
Swap: 4096M Total, 4096M Free

userx@FreeBSD.net:~
$ top -d1 | head -n 6
last pid: 22388;  load averages:  0.23,  0.24,  0.20  up 0+00:49:45    08:36:29
61 processes:  1 running, 59 sleeping, 1 zombie
CPU:  5.4% user,  0.0% nice,  1.4% system,  0.3% interrupt, 92.9% idle
Mem: 2276M Active, 217M Inact, 77M Laundry, 1427M Wired, 529M Buf, 3693M Free
Swap: 4096M Total, 4096M Free

userx@FreeBSD.net:~
$ top -d1 | head -n 6
last pid: 94793;  load averages:  0.13,  0.21,  0.19  up 0+00:50:35    08:37:19
61 processes:  1 running, 59 sleeping, 1 zombie
CPU:  5.4% user,  0.0% nice,  1.4% system,  0.3% interrupt, 92.9% idle
Mem: 2573M Active, 236M Inact, 79M Laundry, 1447M Wired, 526M Buf, 3358M Free
Swap: 4096M Total, 4096M Free
so something is not keeping the memory free in this porgam I hacked into existence.
when I stop running the program the memory jumps back up 3779M Free
Code:
userx@FreeBSD.net:~
$ top -d1 | head -n 6
last pid: 33675;  load averages:  0.82,  0.39,  0.25  up 0+00:53:54    08:40:38
60 processes:  1 running, 58 sleeping, 1 zombie
CPU:  5.6% user,  0.0% nice,  1.4% system,  0.3% interrupt, 92.7% idle
Mem: 2046M Active, 274M Inact, 103M Laundry, 1491M Wired, 530M Buf, 3779M Free
Swap: 4096M Total, 4096M Free
here it dropped to 3 digits?
Code:
$ top -d1 | head -n 6
last pid: 55681;  load averages:  0.47,  0.26,  0.22  up 0+01:12:41    08:59:25
63 processes:  1 running, 61 sleeping, 1 zombie
CPU:  5.1% user,  0.0% nice,  1.4% system,  0.3% interrupt, 93.1% idle
Mem: 2598M Active, 3355M Inact, 210M Laundry, 1303M Wired, 202M Buf, 227M Free
Swap: 4096M Total, 4096M Free

Notice: I maybe over reacting.
 
...
so something is not keeping the memory free in this porgam I hacked into existence.
when I stop running the program the memory jumps back up 3779M Free
...

In the given thread there is a lot of code which seemingly was being hacked by you. Are you talking about the sources named filelist.c/.h?

clang --analyze -I/usr/local/include filelist.c
Code:
filelist.c:246:9: warning: Potential leak of memory pointed to by 'newName'
        return;
        ^~~~~~
1 warning generated.

Replacing line 245 with the following would resolve the potential memory leak.
Code:
     {
        free(newName);
        return;
     }
 
In the given thread there is a lot of code which seemingly was being hacked by you. Are you talking about the sources named filelist.c/.h?

clang --analyze -I/usr/local/include filelist.c
Code:
filelist.c:246:9: warning: Potential leak of memory pointed to by 'newName'
        return;
        ^~~~~~
1 warning generated.

Replacing line 245 with the following would resolve the potential memory leak.
Code:
     {
        free(newName);
        return;
     }
I'll look into that as I was doing free the image via Imlib2 function call.
Code:
^C==90436== 
==90436== HEAP SUMMARY:
==90436==     in use at exit: 0 bytes in 0 blocks
==90436==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==90436== 
==90436== All heap blocks were freed -- no leaks are possible
==90436== 
==90436== For counts of detected and suppressed errors, rerun with: -v
==90436== Use --track-origins=yes to see where uninitialised values come from
==90436== ERROR SUMMARY: 79 errors from 15 contexts (suppressed: 0 from 0)
and that free memory at like 400M so I looked up how to understand the top memory stats in FreeBSD. so
Code:
$ top -d1 | head -n 4
last pid: 21255;  load averages:  0.69,  0.48,  0.42  up 0+00:40:55    10:10:53
79 processes:  2 running, 76 sleeping, 1 zombie
CPU:  5.5% user,  0.0% nice,  2.2% system,  0.8% interrupt, 91.5% idle
Mem: 2092M Active, 4415M Inact, 37M Laundry, 985M Wired, 220M Buf, 190M Free
4415M inact is just memory (cache) hanging around ready to be reused on demand, plus 190Free - 8GB = total actual available memory.

and thanks for that little tid bit on clang
Code:
clang --analyze -I/usr/local/include filelist.c
again, let me to change that real quick, now.

Now, I'm going to let it run and see if it starts slowing down my system, or locking it up again.
 
I'm not sure what the sysctl messages are related to.

The libc faults are likely to be harmless and ought to be in the default suppressions file.

I am sure as to why no leaks are detected (and indeed no faults in any dynamically allocated memory). This is because the ports version of Valgrind doesn't handle the ELF PT_LOAD program headers that are generated in current (12.1 at the time of writing) FreeBSD applications. This causes Valgrind to fail to redirect all libc (and libc++/libstdc++) symbol table entries. In simpler terms, Valgrind can no longer see 'malloc', 'new' etc.
 
Back
Top