Using mallopt() to detect memory leaks

I read the tutorial “Heap Analysis - Making Memory Errors a thing of the past” from

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;
mallopt(MALLOC_CKACCESS, opt);
p=(char *)malloc(50);
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,