Hi djgpp gurus !
I have a little problem when I want to detect available memory with
djgpp V2. (I think this is about the same with v1.12m4).
Here is a little program that demonstrate the problem. The values returned
by the prog are quite strange. look by yourself.
Are there ather ways to get available memory ?
Thanks.
-- Sample program memory.cc ----------
#include <stdlib.h>
#include <dpmi.h>
#include <stdio.h>
void PrintFreeMem(void)
{ printf("Free Physical memory : %uld bytes\n",_go32_dpmi_remaining_physical_memory());
printf("Free Virtual memory : %uld bytes\n",_go32_dpmi_remaining_virtual_memory());
}
int main()
{ printf("MEMORY free test - DJGPP compiler\n");
PrintFreeMem();
printf("\nAllocation 34658 bytes...\n\n");
char *Dummy=(char*)malloc(34658);
PrintFreeMem();
printf("\nFreeing the memory allocated\n\n");
free(Dummy);
PrintFreeMem();
printf("\nDone.\n");
return 0;
}
--
Eric Nicolas <nic...@dsys.ceng.cea.fr>
> Here is a little program that demonstrate the problem. The values returned
> by the prog are quite strange. look by yourself.
The programs you posted work as they should. Why? This is explained in
the DJGPP FAQ list (available in the file faq200b.zip from the same place
you get DJGPP), section 15.2. Or point your Web browser to this URL:
http://www.delorie.com/djgpp/v2faq/faq087.html#Confusing alloc
and read that section on-line.