Mail Archives: djgpp/2000/10/03/09:01:52
On Tue, 3 Oct 2000, Haim Cohen wrote:
> Is someone know how to get the size of the available memory in the system by
> C/C++ standard routines or assembly commands ?
> I mean the physical available memory, the size that the BIOS detects on
> system boot.
On what OS? Some of the platforms supported by DJGPP won't let you know
that, no matter how hard do you try.
Also, do you need to know the total size of physical memory, or the
amount that is free at the moment of the call, and for what purpose?
(There's a reason for these questions: finding the amount of memory under
most modern OSes is tricky, and can easily produce misleading results.
Take a look at chapter 15 of the DJGPP FAQ list, for the details.)
The DJGPP library provides the `_go32_dpmi_remaining_physical_memory '
function for this purpose. Another possibility is to call the function
`_go32_dpmi_get_free_memory_information'.
As for the amount of memory recorded in the system's CMOS memory, code to
access that was posted here several times in the past (it is advisable to
search http://www.delorie.com/djgpp/mail-archives/ before posting
questions). One message that includes that code can be found at this URL:
http://www.delorie.com/djgpp/mail-archives/browse.cgi?p=djgpp/1997/01/11/03:26:50
Note that, if your machine has more than 64MB of RAM installed, the code
posted in the above URL will return RAM % 64MB.
- Raw text -