what's going on? GlobalMemoryStatusEx() always returns failure. I even memset()
the struct with 0's, no difference.
#include <iostream>
#Include <memory.h>
#include <windows.h>
#include <stdint.h>
#include <WinBase.h>
typedef uint64_t addressType; //with 64-bit boxes, there may be support for
__int128, but I guess not yet with some compilers
typedef uint64_t vecElementType;
MEMORYSTATUSEX mse;
addressType availableRAM(void) {
memset(&mse,0, sizeof(MEMORYSTATUSEX));
if (0==GlobalMemoryStatusEx(&mse)) {
std::cout<<"GlobalMemoryStatusEx():ERROR\n";
return 0;
}
addressType ram=mse.ullAvailPhys;
std::cout<<"availableRam()="<<ram<<"\n";
return ram; //do I need to use a percentage here? is there a structure
overhead with bitset?
}
int main(int argc, char * argv[]) {
UINT_TYPE n=0;
size_t sp,ep;
availRam = availableRAM();
if (0!=availRam) {
availRam -= RESERVE_RAM;//2*2^30. we reserve 2GiB for applications to
run fast like browsers etc
}
return 0;
}
-------------
Jim Michaels
jmich...@yahoo.com
j...@renewalcomputerservices.com
http://RenewalComputerServices.com
http://JesusnJim.com (my personal site, has software)
---
IEC Units: Computer RAM & SSD measurements, microsoft disk size measurements
(note: they will say GB or MB or KB or TB when it is IEC Units!):
[KiB] [MiB] [GiB] [TiB]
[2^10B=1,024^1B=1KiB]
[2^20B=1,024^2B=1,048,576B=1MiB]
[2^30B=1,024^3B=1,073,741,824B=1GiB]
[2^40B=1,024^4B=1,099,511,627,776B=1TiB]
[2^50B=1,024^5B=1,125,899,906,842,624B=1PiB]
SI Units: Hard disk industry disk size measurements:
[KB] [MB] [GB] [TB]
[10^3B=1,000B=1KB]
[10^6B=1,000,000B=1MB]
[10^9B=1,000,000,000B=1GB]
[10^12B=1,000,000,000,000B=1TB]
[10^15B=1,000,000,000,000,000B=1PB]
------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public