Category : Tutorials + Patches
Archive   : WINPERF.ZIP
Filename : Q38009

 
Output of file : Q38009 contained in archive : WINPERF.ZIP
Q38009 Determining Free Memory: Conventional and Expanded
Microsoft Windows Software Development Kit (WINSDK)
2.x
MS-DOS

Question:

How can my application determine how much memory is available on the
system, including expanded memory? I tried using GlobalCompact(0), but
it doesn't report on expanded memory.

Response:

You should continue to use GlobalCompact(0) to find out how much
conventional memory is available. The return value from
GlobalCompact(0) is the most accurate statement of how much memory is
available to your application. However, there is no Windows API
routine to tell you how much expanded memory exists (or is free).

Instead, you need to make direct calls to the Expanded Memory
Manager using the Lotus/Intel/Microsoft Expanded Memory Specification
(LIM EMS) Version 3.2.

You can read about EMS in Chapter 9, Pages 182-186, of Ray Duncan's
book, "Advanced MS-DOS" (Microsoft Press, 1986). Section IV at the
back of this book is a reference manual to the various INT 67H calls
to the Expanded Memory Manager.

You can also get a copy of the Lotus/Intel/Microsoft (LIM) Expanded
Memory Specification (part number 300275-003) by writing to Intel at
the following address:

Intel Corporation
3065 Bowers Avenue
Santa Clara, CA 95051

Although Windows itself uses LIM EMS 4.0, your application can only
make calls to LIM EMS 3.2. To do this, you need to compile your
application with the -l switch to the resource compiler:

rc -l -r ......

For more information on the -l switch, query in the KnowledgeBase for
"ems and rc". For an in-depth discussion of Windows and EMS, please
see Paul Yao's article "EMS Support Improves Microsoft Windows 2.0
Application Performance" in the January 1988 issue of the "Microsoft
Systems Journal." This article is also available in the Software
Library by searching on the filename WINEMS.ARC, the Q number of this
article, or S12242.

To find out how much expanded memory you have on your system, you need
to do the following:

1. Ensure that the Expanded Memory Manager is present on your system.
Ray Duncan's book gives two examples of how to detect it.

2. Test to see if the expanded memory hardware is functional. This is
INT 67H function 01H.

3. Get the number of expanded memory pages. This is INT 67H function
03H. This interrupt tells you the total number of expanded memory
pages present in the system, and the number of those pages that are
not already allocated.

Keywords: SR# G881109-5986 softlib MSJ V3N1

Updated 89/04/18 07:05


  3 Responses to “Category : Tutorials + Patches
Archive   : WINPERF.ZIP
Filename : Q38009

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/