This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- How can I determine the amount of physical memory (RAM) available?
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 02, 2006
01:01 PM
How can I determine the amount of physical memory (RAM) available?
The amount of RAM installed on a machine...
I see that I can get this info in the DevStudio product...
http://helpnet.installshield.com/robo/projects/HelpLibDevStudio9/IHelpPropReference.htm#Hardware
How can I get it in InstallShield MP 11.5?
Or, if there is no automatic wizardly way, can somebody tell me if/how this information can be obtained from Java?
Thanks!
I see that I can get this info in the DevStudio product...
http://helpnet.installshield.com/robo/projects/HelpLibDevStudio9/IHelpPropReference.htm#Hardware
How can I get it in InstallShield MP 11.5?
Or, if there is no automatic wizardly way, can somebody tell me if/how this information can be obtained from Java?
Thanks!
(2) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 06, 2006
07:50 PM
Java cannot make this call. You'll need to make a JNI call to the. Here are the calls you'd need to make in C to get system memory in Windows and UNIX.
Cheers,
--Will
Cheers,
--Will
#ifdef WIN32
MEMORYSTATUS ms;
GlobalMemoryStatus(&ms);
//Debug 1024000L 1048576L
//printf("Total physical: %lu bytes (%luMB)\n", ms.dwTotalPhys, ms.dwTotalPhys / 1048576L);
return (ms.dwTotalPhys / 1048576L);
#endif
/**
* sysconf(_SC_PHYS_PAGES) returns a long containing the number of memory pages;
* you have then to multiply by sysconf(_SC_PAGESIZE), the number of bytes
* per memory page (that varies depending from the hardware you have).
* And to divide by 1024*1024 if you need units of Megabytes :-)
*/
#ifndef WIN32
long n_phys, s_phys;
n_phys = (sysconf (_SC_PHYS_PAGES)/1024) * (sysconf (_SC_PAGESIZE)/1024);
return n_phys;
#endif
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 10, 2006
08:53 AM
Thanks, I appreciate the post!