Not able to get the Leak summery details in ARM architecture

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Not able to get the Leak summery details in ARM architecture

venkat konamki

Hi,

#include <stdio.h>
#include <stdlib.h>
int main(){
    int n,i,*ptr,sum=0;
    printf("Enter number of elements: ");
    scanf("%d",&n);
    ptr=(int*)malloc(n*sizeof(int));  //memory allocated using malloc
    if(ptr==NULL)
    {
        printf("Error! memory not allocated.");
        exit(0);
    }
    printf("Enter elements of array: ");
    for(i=0;i<n;++i)
    {
        scanf("%d",ptr+i);
        sum+=*(ptr+i);
    }
    printf("Sum=%d",sum);
   // free(ptr);
    return 0;
}

I have compiled the above program using below commands

arm-linux-gnueabi-gcc -o test-arm -g test.c
arm-linux-gnueabi-gcc -o test-arm-static -g test.c 

when i am running in my ARM architecture with valgrind

1) valgrind --tool=memcheck --leak-check=yes --show-reachable=yes ./test-arm
valgrind: m_ume.c: can't open interpreter
2) /writable/valgrind/bin/valgrind --tool=memcheck --leak-check=yes --show-reachable=yes  ./test-arm-static                 
==8118== Memcheck, a memory error detector ==8118== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al. ==8118== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info ==8118== Command: ./test-arm-static ==8118== Enter number of elements: 1 Enter elements of array: 1 Sum=1==8118== ==8118== HEAP SUMMARY: ==8118== in use at exit: 0 bytes in 0 blocks ==8118== total heap usage: 0 allocs, 0 frees, 0 bytes allocated ==8118== ==8118== All heap blocks were freed -- no leaks are possible ==8118== ==8118== For counts of detected and suppressed errors, rerun with: -v ==8118== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
In both the cases i didn't get LEAK SUMMERY , but in my linux machine i am able to get the valgrind report. can you suggest me the how to resolve this on ?

Thanks,

Venkateswarlu.K

------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Valgrind-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/valgrind-users
Reply | Threaded
Open this post in threaded view
|

Re: Not able to get the Leak summery details in ARM architecture

Tom Hughes-2
On 12/04/16 11:52, venkat konamki wrote:

> I have compiled the above program using below commands
>
> arm-linux-gnueabi-gcc -o test-arm -g test.c
> arm-linux-gnueabi-gcc -o test-arm-static -g test.c
>
> when i am running in my ARM architecture with valgrind

So that looks like you are cross compiling? But you are actually running
valgrind on the target machine, not on the host where you do the compil?

> 1) valgrind --tool=memcheck --leak-check=yes --show-reachable=yes ./test-arm
>
> valgrind: m_ume.c: can't open interpreter

Well that means whatever ELF interpreter your program is declaring can't
be opened by valgrind. Run "file ./test-arm" and see what interpreter it
says it is using.

> 2) /writable/valgrind/bin/valgrind --tool=memcheck --leak-check=yes
> --show-reachable=yes ./test-arm-static
>
> ==8118== Memcheck, a memory error detector ==8118== Copyright (C)
> 2002-2013, and GNU GPL'd, by Julian Seward et al. ==8118== Using
> Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info ==8118==
> Command: ./test-arm-static ==8118== Enter number of elements: 1 Enter
> elements of array: 1 Sum=1==8118== ==8118== HEAP SUMMARY: ==8118== in
> use at exit: 0 bytes in 0 blocks ==8118== total heap usage: 0 allocs, 0
> frees, 0 bytes allocated ==8118== ==8118== All heap blocks were freed --
> no leaks are possible ==8118== ==8118== For counts of detected and
> suppressed errors, rerun with: -v ==8118== ERROR SUMMARY: 0 errors from
> 0 contexts (suppressed: 0 from 0)
>
> In both the cases i didn't get LEAK SUMMERY , but in my linux machine i
> am able to get the valgrind report. can you suggest me the how to
> resolve this on ?

You won't be able to get a leak report for a statically linked program
because valgrind won't be able to intercept calls to malloc and free.

Tom

--
Tom Hughes ([hidden email])
http://compton.nu/

------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Valgrind-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/valgrind-users
Reply | Threaded
Open this post in threaded view
|

Re: Not able to get the Leak summery details in ARM architecture

venkat konamki
I have compiled the above program using below commands

arm-linux-gnueabi-gcc -o test-arm -g test.c
arm-linux-gnueabi-gcc -o test-arm-static -g test.c

when i am running in my ARM architecture with valgrind

So that looks like you are cross compiling? But you are actually running valgrind on the target machine, not on the host where you do the compil?
 
    -----> Yes i cross compiled both test app and valgrind, then i copied to target machine.
 I cross compiled valgrind like this ./configure --host=arm-linux-gnueabi --target=arm-linux-gnueabi

1) valgrind --tool=memcheck --leak-check=yes --show-reachable=yes ./test-arm

valgrind: m_ume.c: can't open interpreter

Well that means whatever ELF interpreter your program is declaring can't be opened by valgrind. Run "file ./test-arm" and see what interpreter it says it is using.

2) /writable/valgrind/bin/valgrind --tool=memcheck --leak-check=yes
--show-reachable=yes ./test-arm-static

==8118== Memcheck, a memory error detector ==8118== Copyright (C)
2002-2013, and GNU GPL'd, by Julian Seward et al. ==8118== Using
Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info ==8118==
Command: ./test-arm-static ==8118== Enter number of elements: 1 Enter
elements of array: 1 Sum=1==8118== ==8118== HEAP SUMMARY: ==8118== in
use at exit: 0 bytes in 0 blocks ==8118== total heap usage: 0 allocs, 0
frees, 0 bytes allocated ==8118== ==8118== All heap blocks were freed --
no leaks are possible ==8118== ==8118== For counts of detected and
suppressed errors, rerun with: -v ==8118== ERROR SUMMARY: 0 errors from
0 contexts (suppressed: 0 from 0)

In both the cases i didn't get LEAK SUMMERY , but in my linux machine i
am able to get the valgrind report. can you suggest me the how to
resolve this on ?

You won't be able to get a leak report for a statically linked program because valgrind won't be able to intercept calls to malloc and free.

Thanks,

Venkateswarlu.K

On Tue, Apr 12, 2016 at 4:46 PM, Tom Hughes <[hidden email]> wrote:
On 12/04/16 11:52, venkat konamki wrote:

I have compiled the above program using below commands

arm-linux-gnueabi-gcc -o test-arm -g test.c
arm-linux-gnueabi-gcc -o test-arm-static -g test.c

when i am running in my ARM architecture with valgrind

So that looks like you are cross compiling? But you are actually running valgrind on the target machine, not on the host where you do the compil?

1) valgrind --tool=memcheck --leak-check=yes --show-reachable=yes ./test-arm

valgrind: m_ume.c: can't open interpreter

Well that means whatever ELF interpreter your program is declaring can't be opened by valgrind. Run "file ./test-arm" and see what interpreter it says it is using.

2) /writable/valgrind/bin/valgrind --tool=memcheck --leak-check=yes
--show-reachable=yes ./test-arm-static

==8118== Memcheck, a memory error detector ==8118== Copyright (C)
2002-2013, and GNU GPL'd, by Julian Seward et al. ==8118== Using
Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info ==8118==
Command: ./test-arm-static ==8118== Enter number of elements: 1 Enter
elements of array: 1 Sum=1==8118== ==8118== HEAP SUMMARY: ==8118== in
use at exit: 0 bytes in 0 blocks ==8118== total heap usage: 0 allocs, 0
frees, 0 bytes allocated ==8118== ==8118== All heap blocks were freed --
no leaks are possible ==8118== ==8118== For counts of detected and
suppressed errors, rerun with: -v ==8118== ERROR SUMMARY: 0 errors from
0 contexts (suppressed: 0 from 0)

In both the cases i didn't get LEAK SUMMERY , but in my linux machine i
am able to get the valgrind report. can you suggest me the how to
resolve this on ?

You won't be able to get a leak report for a statically linked program because valgrind won't be able to intercept calls to malloc and free.

Tom

--
Tom Hughes ([hidden email])
http://compton.nu/


------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Valgrind-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/valgrind-users