Determining free memory using the System plugin: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
m (Adding new author and category links.) |
|||
Line 6: | Line 6: | ||
== The Function == | == The Function == | ||
<highlight-nsis> | <highlight-nsis> | ||
System::Alloc | System::Alloc 31 | ||
Pop $1 | Pop $1 | ||
System::Call "Kernel32::GlobalMemoryStatus(i) v (r1)" | System::Call "Kernel32::GlobalMemoryStatus(i) v (r1)" |
Revision as of 10:37, 3 February 2009
Author: sunjammer (talk, contrib) |
Description
KiCHiK came up with this NSIS code to check free RAM using the System plugin (original forum posting)
The Function
System::Alloc 31 Pop $1 System::Call "Kernel32::GlobalMemoryStatus(i) v (r1)" System::Call "*$1(&i4 .r2, &i4 .r3, &i4 .r4, &i4 .r5, \ &i4 .r6, &i4.r7, &i4 .r8, &i4 .r9)" System::Free $1 DetailPrint "Structure size (useless): $2 Bytes" DetailPrint "Memory load: $3%" DetailPrint "Total physical memory: $4 Bytes" DetailPrint "Free physical memory: $5 Bytes" DetailPrint "Total page file: $6 Bytes" DetailPrint "Free page file: $7 Bytes" DetailPrint "Total virtual: $8 Bytes" DetailPrint "Free virtual: $9 Bytes"