foolish question

Hi !

I have trouble in determine available memory in QNX 4.25 in flat model
(Watcom C++ 10.6)
I tried _memavail - but it returns wrong answer.
And now I use my own function, which tries to alloc as much memory as can.
Thus I determine available memory.
Does anyone know how can I do it in other ways ?

“õÓÔÉÎÏ× ðÁ×ÅÌ” <rotozoom@mail.ru> wrote in message
news:b0qqhj$bn5$1@inn.qnx.com

Hi !

I have trouble in determine available memory in QNX 4.25 in flat model
(Watcom C++ 10.6)
I tried _memavail - but it returns wrong answer.
And now I use my own function, which tries to alloc as much memory as can.
Thus I determine available memory.
Does anyone know how can I do it in other ways ?

#include <sys/osinfo.h>

void get_free_mem() {
struct _osinfo osinfo;
if (qnx_osinfo(0, &osinfo) == 0) {
printf(“free=%ld total=%ld”, osinfo.freepmem, osinfo.totpmem);
}
}

// wbr

“õÓÔÉÎÏ× ðÁ×ÅÌ” <rotozoom@mail.ru> wrote in message
news:b0qqhj$bn5$1@inn.qnx.com

Hi !

I have trouble in determine available memory in QNX 4.25 in flat model
(Watcom C++ 10.6)
I tried _memavail - but it returns wrong answer.

It returns the amount of free memory on the HEAP.

And now I use my own function, which tries to alloc as much memory as can.

Memory allocated by a process is NOT return to the OS when it`s freed, hence
unless the application terminate you will consume all system memory.

Thus I determine available memory.
Does anyone know how can I do it in other ways ?