On Wed, 2012-07-11 at 08:05 +0000, Maddy wrote:

> The output shows 0 leaks reported
> 
>      int main()
>      {
>      printf("I am leaking.");
>      int *a =(int *) malloc(100);
>      return 0;
>      }
> 
> This ran on linux just fine and reported memory leaks. If this programme would
> have worked on powerpc, then I would have run Valgrind on project specific
> processes. 
Does the output reports that there is still a block allocated ?
It is not abnormal to have the below not detected.
E.g. if a register keeps a copy of the value of a, then the leak search
of Valgrind will consider that the malloc-ed block is still reachable.
(note: in Valgrind 3.8.0, there is a new functionality which allows to
show why a block is still considered as reachable).
E.g. on my linux fedora12/x86, the below program 
int main()
{
    char *ch = (char*)malloc(sizeof(10));
    ch = (void*)0x0;
}
also shows no leak, while clearly it leaks even more than yours.

However, it reports:
...
==2431== HEAP SUMMARY:
==2431==     in use at exit: 4 bytes in 1 blocks
...
==2431==    still reachable: 4 bytes in 1 blocks


If the output reports that there was no block ever allocated (and no
block still reachable), then it probably means that the malloc
function was not properly intercepted by Valgrind.
Use a bunch of -v, -d args together with --trace-redir=yes
to investigate what happens.

Philippe



------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Valgrind-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to