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&reg; 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
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users
------------------------------------------------------------------------------
BlackBerry&reg; 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
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to