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
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to