|
From: Ionut D. <ion...@gm...> - 2011-08-03 09:42:58
|
Hi,
I tried ValGrind on a VirtualBox running Ubuntu.
My sample code is :
#include <stdlib.h>
#include <stdio.h>
void get_mem() {
char *ptr;
ptr = (char *) malloc (10);
}
int main(void) {
get_mem();
}
I compile it with -O0 -g options, then run the executable with:
valgrind -v --leak-check=yes ./Test
In the end, I get "All heap bloks were freed, etc".
I also checked memory overflow checking, but that is doesn't work, as well.
Instead, I get a lot of "Conditional jump or remove depends on uninitialied
values" warnings.
These messages refer to get_mem and main functions, showing that no code has
been eliminated by the compiler.
Do I miss anything?
Kind Regards,
Ionut.
|
|
From: Jérémy C. <jer...@fr...> - 2011-08-03 09:58:18
|
Try 'return 0' at the end of main() function.
Please suppress any gcc warning before playing with valgrind.
Jeremy
Le 03/08/2011 11:42, Ionut Dinulescu a écrit :
>
> Hi,
>
> I tried ValGrind on a VirtualBox running Ubuntu.
>
> My sample code is :
>
> #include <stdlib.h>
> #include <stdio.h>
>
> void get_mem() {
> char *ptr;
> ptr = (char *) malloc (10);
> }
>
> int main(void) {
> get_mem();
> }
>
> I compile it with -O0 -g options, then run the executable with:
> valgrind -v --leak-check=yes ./Test
>
> In the end, I get "All heap bloks were freed, etc".
> I also checked memory overflow checking, but that is doesn't work, as
> well.
>
> Instead, I get a lot of "Conditional jump or remove depends on
> uninitialied values" warnings.
> These messages refer to get_mem and main functions, showing that no
> code has been eliminated by the compiler.
>
>
> Do I miss anything?
>
> Kind Regards,
> Ionut.
>
>
> ------------------------------------------------------------------------------
> BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
> The must-attend event for mobile developers. Connect with experts.
> Get tools for creating Super Apps. See the latest technologies.
> Sessions, hands-on labs, demos& much more. Register early& save!
> http://p.sf.net/sfu/rim-blackberry-1
>
>
> _______________________________________________
> Valgrind-users mailing list
> Val...@li...
> https://lists.sourceforge.net/lists/listinfo/valgrind-users
|
|
From: Thomas R. <tr...@st...> - 2011-08-03 10:22:15
|
Ionut Dinulescu wrote:
> Hi,
>
> I tried ValGrind on a VirtualBox running Ubuntu.
Which version?
> #include <stdlib.h>
> #include <stdio.h>
>
> void get_mem() {
> char *ptr;
> ptr = (char *) malloc (10);
> }
>
> int main(void) {
>
> get_mem();
> }
>
> I compile it with -O0 -g options, then run the executable with:
> valgrind -v --leak-check=yes ./Test
>
> In the end, I get "All heap bloks were freed, etc".
I get
==28496== HEAP SUMMARY:
==28496== in use at exit: 10 bytes in 1 blocks
==28496== total heap usage: 1 allocs, 0 frees, 10 bytes allocated
==28496==
==28496== 10 bytes in 1 blocks are definitely lost in loss record 1 of 1
==28496== at 0x4C2683D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==28496== by 0x400545: get_mem (in /home/thomas/tmp/memleak)
==28496== by 0x400559: main (in /home/thomas/tmp/memleak)
on both 3.6.1 and SVN.
> Instead, I get a lot of "Conditional jump or remove depends on uninitialied
> values" warnings.
Sounds like you are lacking a default suppressions file for your libc.
--
Thomas Rast
trast@{inf,student}.ethz.ch
|