本帖最后由 elvafans_hehe 于 2009-08-24 22:27:27 编辑

解决方案 »

  1.   

    我测试的是正常的。 [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 是物理内存
      

  2.   

    如果是WEB的话,会不会因为权限问题?如果是WINFORM,我也试了,没有问题,会不会跟32/64有问题?
      

  3.   

     
            public uint TotalPhys;     
            public uint AvailPhys;     
            public uint TotalPageFile;     
            public uint AvailPageFile; 
    这四个都正常??另外问问,        public uint MemoryLoad;    这个是不是整个内存使用率(%)呢?  
      

  4.   


    我编译成.exe文件,作为控制台窗口的输出,不用在web上。我也查看过服务器的系统信息里面是x86
      

  5.   

    不知道LZ的是什么系统.
    目前的XP系统和我现在用的vista系统,最大都只能支持到3G内存.
    也就是说你即使插了4G的条子也只能用3G(服务器版的windows不太清楚).
      

  6.   

    我的是xp系统的本本2G内存,我是把做好的控制台程序放在了一台4G内存的PCserver上面运行,发现的问题
      

  7.   

    刚查了下.服务器版的Win 2003默认最大也是3G
    你插4G的条子估计认不出来吧...
      

  8.   

    现在对于XP能认多少内存,2003能认多少内存不重要。我在公司的服务器上面看到我的电脑属性中的物理内存是4G了。就算是目前只能认到3G。他也应该把TotalPhys查处来是3G啊,结果现在是TotalPhys:2147483647
      

  9.   

    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.
      

  10.   

    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!
      

  11.   

    我的机器上,4G内存,Win 2008 x86,GlobalMemoryStatus返回值不正确,GlobalMemoryStatusEx正确