Hi all,
I read the tutorial “Heap Analysis - Making Memory Errors a thing of the past” from www.qnx.com.
It describes how to find memory leak using malloc_g library.
I tried a sample program. However, its not geting compiled. Can somebody please help.
The code:
#include <malloc_g/malloc.h>
#include <string.h>
int main()
{
char *p;
union malloptarg opt;
opt.i=1;
mallopt(MALLOC_CKACCESS, opt);
p=(char *)malloc(50);
free(p);
strcpy(p, “Hello world”);
printf("%s", p);
return 0;
}
I compile it as:
gcc -lmalloc_g myprog.c
I get the compile time error, storage size of ‘opt’ isn’t known.
I am new to QNX. Any help would be valuable.
Thanking in advance,
Purav.