delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/08/18/10:30:36

From: "Rafał Maj" <r_maj AT poczta DOT onet DOT pl>
Newsgroups: comp.os.msdos.djgpp
Subject: get free memory info doesn't work !
Date: Fri, 18 Aug 2000 16:14:03 +0200
Organization: Academic Computer Center CYFRONET AGH
Lines: 40
Message-ID: <8njgsi$5ps$1@info.cyf-kr.edu.pl>
NNTP-Posting-Host: d-94-53-08.cyfronet.krakow.pl
X-Trace: info.cyf-kr.edu.pl 966608594 5948 149.156.1.168 (18 Aug 2000 14:23:14 GMT)
X-Complaints-To: news AT cyf-kr DOT edu DOT pl
NNTP-Posting-Date: 18 Aug 2000 14:23:14 GMT
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2615.200
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

This program doesn't show correctly amount of free memory...
Why ?
How can I change it ?

#include <go32.h>
#include <dpmi.h>
#include <iomanip.h>
#include <iostream.h>

void info() {
  _go32_dpmi_meminfo info;
  _go32_dpmi_get_free_memory_information(&info);
  cerr <<setw(9) <<  (info.available_memory  / 1024) << "    "
       <<setw(9) << ((info.available_physical_pages * 4096) / 1024)<< "    "
       <<setw(9) << ((info.available_pages * 4096) / 1024) <<
       endl;
}

int main()
{
  info();
  char* ptr = new char[10*1024*1024];  info();
  ptr[6*1024*1024]=1;  info();
  delete[] ptr;  info();

  return 0;
}


---------------- contents of stderr -
    59136        40136        59136
    48832        40136        48832    <=== It's OK
    48832        40136        48832
    48832        40136        48832    <==== Why delete[] dosn't change
information about free memory ?

Thanks for reading
Rafal


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019