Special

Clearance Sale!

We've been publishing for over five years now and it's time to clear out our inventory of back issues, so we're slashing prices!

RBD Magazines

Check out this amazing clearance sale of all our past issues. Missing some issues? This is a great time to complete your RBD collection. Save up to 40% off the regular price of our printed back issue packages. These prices are only good until the end of the year May 2008 and supplies are limited, so place your order today.

Article Preview


Buy Now

Print:
PDF:

Intel corner

Memory

Statistics on free and total memory on Windows

Issue: 3.5 (May/June 2005)
Author: Christian Schmitz
Author Bio: Christian Schmitz is the creator of the Monkeybread Software REALbasic Plugins.
Article Description: No description available.
Article Length (in bytes): 4,447
Starting Page Number: 42
RBD Number: 3519
Resource File(s):

Download Icon 3519.sit Updated: Wednesday, May 18, 2005 at 11:41 AM
Download Icon 3519.zip Updated: Wednesday, May 18, 2005 at 11:41 AM

Related Link(s): None
Known Limitations: None

Excerpt of article text...

One piece of information REALbasic does not give you built-in is the amount of free memory you can use. This article will give you some code to get a few values about the current state of memory usage.

Query memory statistics

The call we use is the function GlobalMemoryStatus, which stores memory statistics in a memoryblock. This function does not have a return code (in C: VOID GlobalMemoryStatus(LPMEMORYSTATUS lpBuffer);). The function is part of Kernel32.dll, so the declare looks like this:

declare sub GlobalMemoryStatus lib "KERNEL32" (buffer as ptr).

This call is supported in Windows NT, Windows 98, and later versions of Windows. In Windows 2000 or newer you will also find a GlobalMemoryStatusEx call which returns correct values if there are more than 2 GB of RAM inside the PC. Our GlobalMemoryStatus call will report no more than 2 GB of RAM, but as REALbasic applications are 32bit applications they can only address 2 GB of RAM; the limit should not be a problem. (Address space is 4 GB per process, but Windows reserves 2 GB for system use.)

...End of Excerpt. Please purchase the magazine to read the full article.

Article copyrighted by REALbasic Developer magazine. All rights reserved.


 


|

 


Weblog Commenting and Trackback by HaloScan.com