determine available memory

when we do a ‘pidin info’, one of the information we get is the total available memory. Is there a way to determine this by software.

struct stat64 st;

stat64( “/proc”, &st);
st.st_size; // containd ram size

i think i was incorrect in my question, want to extract the total memory, for instance on a system it could be 183 Mb/255Mb, how can i get the total memory which is 255Mb?

off64_t get_total_mem(void)
char *str = SYSPAGE_ENTRY(strings)->data;
struct asinfo_entry *as = SYSPAGE_ENTRY(asinfo);
off64_t total = 0;
unsigned num;

for(num = _syspage_ptr->asinfo.entry_size / sizeof(*as); num > 0; --num) 
 	if(strcmp(&str[as->name], "ram") == 0) 
		total += as->end - as->start + 1;


return total;

I have tried to compile the code, but am getting warnings and errors.
I have included <sys/syspage.h>

dereferencing pointer to incomplete type on :
for(num = _syspage_ptr->asinfo.entry_size / sizeof(*as); num > 0; --num)

increment of pointer to unknown structure:

++ as;

these are the errors i am getting. Any other header files to include?

This work on qnx640 and greater, compiler 4.2.4, no other includes need. I don’t probe it on less version.

any recommendations for doing a similar thing on version 6.3.0?

if anyone has done determining total memory on a 6.3.0 system, kindly let me know