全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:2261
推到 Plurk!
推到 Facebook!

記憶體監測的容量(>2GB)的問題!

答題得分者是:syntax
f1driver
一般會員


發表:2
回覆:2
積分:0
註冊:2008-01-07

發送簡訊給我
#1 引用回覆 回覆 發表時間:2008-01-07 12:37:29 IP:61.224.xxx.xxx 訂閱
小弟用下列程式來監測主記憶體的使用量
TMemoryStatus mem;
mem.dwLength=sizeof(TMemoryStatus);
GlobalMemoryStatus(&mem);
但為何mem.dwTotalphys始終都只顯示2GB,我的RAM是3GB
但若RAM在2GB以下都可正確讀取實際的值
這變數不是unsigned long(32bit)嗎???4GB以下應該都能正確讀取
就連mem.dwAvailPhys都是顯示2147483648(2GB)
除非將記憶體用到剩2GB以下才看得到真正實際值,
否則任何大於2GB都只顯示2GB
請教各為前輩這是什麼原因,謝謝!
我的編譯器是BCB5(跟這有關嗎?)
為何會這樣呢?
syntax
尊榮會員


發表:26
回覆:1139
積分:1258
註冊:2002-04-23

發送簡訊給我
#2 引用回覆 回覆 發表時間:2008-01-07 18:10:28 IP:61.64.xxx.xxx 訂閱
系統限制
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
===================引 用 f1driver 文 章===================
小弟用下列程式來監測主記憶體的使用量
TMemoryStatus mem;
mem.dwLength=sizeof(TMemoryStatus);
GlobalMemoryStatus(&mem);
但為何mem.dwTotalphys始終都只顯示2GB,我的RAM是3GB
但若RAM在2GB以下都可正確讀取實際的值
這變數不是unsigned long(32bit)嗎???4GB以下應該都能正確讀取
就連mem.dwAvailPhys都是顯示2147483648(2GB)
除非將記憶體用到剩2GB以下才看得到真正實際值,
否則任何大於2GB都只顯示2GB
請教各為前輩這是什麼原因,謝謝!
我的編譯器是BCB5(跟這有關嗎?)
為何會這樣呢?
編輯記錄
syntax 重新編輯於 2008-01-07 18:12:58, 註解 無‧
f1driver
一般會員


發表:2
回覆:2
積分:0
註冊:2008-01-07

發送簡訊給我
#3 引用回覆 回覆 發表時間:2008-01-07 20:41:10 IP:61.224.xxx.xxx 訂閱
冒昧再請問前輩一下,還有其他方法可以使用嗎?
我看到工作管理員都能顯示到3GB,
還是說這問題已經無解??

感謝前輩熱心為小弟回覆


===================引 用 syntax 文 章===================
系統限制
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
syntax
尊榮會員


發表:26
回覆:1139
積分:1258
註冊:2002-04-23

發送簡訊給我
#4 引用回覆 回覆 發表時間:2008-01-07 23:49:12 IP:61.64.xxx.xxx 訂閱
On computers with more than 4 GB of memory, the GlobalMemoryStatus
function can return incorrect information. Windows 2000 and later report a value
of -1 to indicate an overflow. Earlier versions of Windows NT report a value
that is the real amount of memory, modulo 4 GB. For this reason, use the GlobalMemoryStatusEx function
instead.

===================引 用 f1driver 文 章===================
冒昧再請問前輩一下,還有其他方法可以使用嗎?
我看到工作管理員都能顯示到3GB,
還是說這問題已經無解??

感謝前輩熱心為小弟回覆


===================引 用 syntax 文 章===================
系統限制
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
f1driver
一般會員


發表:2
回覆:2
積分:0
註冊:2008-01-07

發送簡訊給我
#5 引用回覆 回覆 發表時間:2008-01-08 02:26:29 IP:218.167.xxx.xxx 訂閱
yes,成功了,原來還有一個GlobalMemoryStatusEx可用, 太棒了非常謝謝前輩的熱心指導,感激不盡! ^_^
系統時間:2024-04-26 17:00:50
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!