Board index » delphi » Q: Getting total amount of memory

Q: Getting total amount of memory

I'm wondering if there is an easy way, to get information, on total amount of
memory in one's computer.

Best regards

/Baudkern

"Hey, no brain, but what the heck!?"

 

Re:Q: Getting total amount of memory


I

Quote
> > I'm wondering if there is an easy way, to get information, on total amount
of
> > memory in one's computer.

> The maxmem function should help. (turbo 6.0)

Oops, I forgot about maxavail - returns the largest contiguous free block in
the heap, corresponding to the size of the largest dynamic variable that can be
allocated at that time.

Sorry, the maxmem function may be incorrect!

Darrell Fite
arkla...@prysm.com

Re:Q: Getting total amount of memory


In article <NEWTNews.21936.817140451.arkla...@Prysm.unicomp.net>,
   arkla...@prysm.com wrote:
Quote

>> I'm wondering if there is an easy way, to get information, on total amount
of
>> memory in one's computer.

>The maxmem function should help. (turbo 6.0)

By maxmem I assume you mean MaxAvail, and that's not really what I'm after.
I'm looking for total amount of conventional AND extended memory.

/Timmy...

"Hey, no brain, but what the heck!?"

Re:Q: Getting total amount of memory


Hi!
It would be better (and easier), to get Ralf Brown's Interrupt-List!
This is NO FLAME ;), but the LIM 3.0/4.0 - standard is quite a lot to post.
the LIM - standard has a function which will return the number of EMS-pages
used/total. But you'll have to call min 2 more functions BEFORE etc.
The latest version of R.B.IntList is 4.8 (as far as I know.. :-/).

------------------------------------------------------------------
        __    _     _
      _(  |__\ \   / /    Alexander Schweimler
     /  ) | __\ \ / /     Gerbertstr. 1
    / * | ||__ \ \ / *    D-79117 Freiburg
   /  * | | __| > / ***   Tel.   : +49-761-66542
  /   _ | ||__ / ^ \ *    e-mail : schwe...@ruf.uni-freiburg.de
 /___/ || |___/ / \ \
-------|  |__/_/---\_\---*--------+++++++-------------------------
    ** (______\ ***

Re:Q: Getting total amount of memory


Quote
edtt...@kkpc.ericsson.se (Baudkern) wrote:
>I'm wondering if there is an easy way, to get information, on total amount of
>memory in one's computer.
>Best regards
>/Baudkern
>"Hey, no brain, but what the heck!?"

One problem : what memory ?  In my programs, there is always an
info-screen with (between other info) the memory in the PC. Great for
trouble shooting. But : the are EIGHT numbers to return :

Total and Free Conventional memory ( below 640K)
Total and Free Extended memory (above 1 Mb - if no memory manger )
Total and Free XMS memory ( above 1 Mb - if Himem etc loaded)
Total and Free EMS memory

Sorry, you could do two more: Total and Free Upper memory (between
640K and 1 Mb)

I 'll post source code, but since it uses units from TurboPowers
Object Professional (which is copyrighted), I doubt if it will help
you.

----------------------------- cut here -------------------------------

Unit Status;

{ Deze unit bevat de statusroutines }

{$IFNDEF VER40}
  {$A-}
  {$O+,F+}
{$ENDIF}

interface

uses OpCrt, Dos,
     OpExtMem,
     OpEms,
     OpXms;

procedure PrintConfig;

implementation

procedure PrintConfig;

var AT       : boolean;
    regs     : registers;           { registervariabele voor interrupt

Quote
}

    XmsTotaal,
    XmsGrootste : word;
    Resultaat  : byte;

begin

 Writeln('Geheugen                       Totaal            Vrij');
 intr($12, regs);                        { grootte van het RAM bepalen

Quote
}

   write('RAM-geheugen (conventioneel): ',regs.ax,' Kb');
 Gotoxy(50,wherey);
 Writeln(Maxavail / 1024 : 3 : 0,' Kb');
 If EmsInstalled then
 begin
   write('EMS geheugen                : ',LongInt(EmsTotalPages) * 16,
' Kb');
   Gotoxy(50,wherey);
   Writeln(LongInt(EmsPagesAvail) * 16, ' Kb');
 end else
   writeln('EMS geheugen                : 0 Kb');
 if AT then
 begin
    write('Extended geheugen           : ',Trunc(ExtmemTotal / 1024),'
Kb');
    Gotoxy(50,wherey);
    writeln(ExtMemAvail,' Kb');
 end;
 if AT and XMSInstalled then
 begin
   write('Beschikbaar XMS geheugen    : ');
   Resultaat := OpXms.QueryFreeExtmem( XmsTotaal, XmsGrootste);
   If Resultaat = 0 then
   begin
      Write(XMSTotaal,' Kb');
      Gotoxy(50,wherey);
      Writeln(XMSGrootste,' Kb');
   end else
   begin
      Writeln('0 Kb');
      Gotoxy(50,wherey);
      Writeln('0 Kb');
   end;
 end;
end;

end. {implementation}

Other Threads