Xref: news2.mv.net comp.os.msdos.djgpp:1663 From: nicolas AT dsys DOT ceng DOT cea DOT fr (Eric NICOLAS) Newsgroups: comp.os.msdos.djgpp Subject: Pb with free memory detection Date: 5 Mar 1996 07:34:31 GMT Organization: Commissariat a l'energie atomique Lines: 43 Message-ID: <4hgqq7$sdh@news.cea.fr> Reply-To: nicolas AT dsys DOT ceng DOT cea DOT fr NNTP-Posting-Host: 132.168.30.100 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Using: DJGPP V2.0 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 #include #include 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