Hi,
I want to get the hardware RAM size in code, but don't know how to do so. Any advice?Thanks. Best Regards, Jim G _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Assuming you’re on win32, try something along the lines of, Win32SystemSupport>>GlobalMemoryStatus: lpBuffer <C: void GlobalMemoryStatus(MEMORYSTATUS *
lpBuffer)> ^self externalAccessFailedWith: _errorCode. Win32SystemSupport>>MEMORYSTATUS <C: typedef struct _MEMORYSTATUS {
DWORD dwLength;
DWORD dwMemoryLoad;
SIZE_T dwTotalPhys;
SIZE_T dwAvailPhys;
SIZE_T dwTotalPageFile;
SIZE_T dwAvailPageFile;
SIZE_T dwTotalVirtual;
SIZE_T dwAvailVirtual; } MEMORYSTATUS> Win32SystemSupport>>getGlobalMemoryStatus "self new getGlobalMemoryStatus" | lpMemoryStatus | lpMemoryStatus := self MEMORYSTATUS gcMalloc. self GlobalMemoryStatus: lpMemoryStatus. ^(Win32MemoryStatus new) load: (lpMemoryStatus memberAt:
#dwMemoryLoad) asInteger; totalPhysical: (lpMemoryStatus
memberAt: #dwTotalPhys) asInteger; availablePhysical:
(lpMemoryStatus memberAt: #dwAvailPhys) asInteger; totalPageFile: (lpMemoryStatus
memberAt: #dwTotalPageFile) asInteger; availablePageFile:
(lpMemoryStatus memberAt: #dwAvailPageFile) asInteger; totalVirtual: (lpMemoryStatus
memberAt: #dwTotalVirtual) asInteger; availableVirtual:
(lpMemoryStatus memberAt: #dwAvailVirtual) asInteger; yourself. Smalltalk.OS defineClass: #Win32MemoryStatus superclass: #{Core.Object} indexedType: #none private: false instanceVariableNames: 'load totalPhysical
availablePhysical totalPageFile availablePageFile totalVirtual availableVirtual
' classInstanceVariableNames: '' imports: '' category: 'Win32 Available Memory' -Boris -- +1.604.689.0322 DeepCove Labs Ltd. 4th floor 595 Howe Street Vancouver, Canada V6C 2T5 From:
[hidden email] [mailto:[hidden email]] On Behalf Of Jim
Guo Hi, I want to get the hardware RAM size in code, but don't know
how to do so. Any advice?Thanks.
_______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Hi, Boris
It works. Thanks! Best Regards, Jim G On Tue, Sep 1, 2009 at 1:38 AM, Boris Popov <[hidden email]> wrote:
-- Best Regards, Jim G _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Free forum by Nabble | Edit this page |