我测试的是正常的。 [DllImport("kernel32")] public static extern void GlobalMemoryStatus(ref MEMORY_INFO meminfo);
//定义内存的信息结构 [StructLayout(LayoutKind.Sequential)] public struct MEMORY_INFO { public uint dwLength; public uint dwMemoryLoad; public uint dwTotalPhys; public uint dwAvailPhys; public uint dwTotalPageFile; public uint dwAvailPageFile; public uint dwTotalVirtual; public uint dwAvailVirtual; }dwTotalPhys 是物理内存
public uint TotalPhys; public uint AvailPhys; public uint TotalPageFile; public uint AvailPageFile; 这四个都正常??另外问问, public uint MemoryLoad; 这个是不是整个内存使用率(%)呢?
On computers with more than 4 GB of memory, the GlobalMemoryStatus function can return incorrect information, reporting a value of –1 to indicate an overflow. For this reason, applications should use the GlobalMemoryStatusEx function instead.On Intel x86 computers with more than 2 GB and less than 4 GB of memory, the GlobalMemoryStatus function will always return 2 GB in the dwTotalPhys member of the MEMORYSTATUS structure. Similarly, if the total available memory is between 2 and 4 GB, the dwAvailPhys member of the MEMORYSTATUS structure will be rounded down to 2 GB. If the executable is linked using the /LARGEADDRESSAWARE linker option, then the GlobalMemoryStatus function will return the correct amount of physical memory in both members.The information returned by the GlobalMemoryStatus function is volatile. There is no guarantee that two sequential calls to this function will return the same information.
but actually, just for sp1(XP) maybe,althought I don't have the detail data for my opinion, but the truth will be told , my pc was 3GB of memory already, it's working ooook now!
public static extern void GlobalMemoryStatus(ref MEMORY_INFO meminfo);
//定义内存的信息结构
[StructLayout(LayoutKind.Sequential)]
public struct MEMORY_INFO
{
public uint dwLength;
public uint dwMemoryLoad;
public uint dwTotalPhys;
public uint dwAvailPhys;
public uint dwTotalPageFile;
public uint dwAvailPageFile;
public uint dwTotalVirtual;
public uint dwAvailVirtual;
}dwTotalPhys 是物理内存
public uint TotalPhys;
public uint AvailPhys;
public uint TotalPageFile;
public uint AvailPageFile;
这四个都正常??另外问问, public uint MemoryLoad; 这个是不是整个内存使用率(%)呢?
我编译成.exe文件,作为控制台窗口的输出,不用在web上。我也查看过服务器的系统信息里面是x86
目前的XP系统和我现在用的vista系统,最大都只能支持到3G内存.
也就是说你即使插了4G的条子也只能用3G(服务器版的windows不太清楚).
你插4G的条子估计认不出来吧...