Determining free memory using the System plugin: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
m (Updated author links.) |
m (Added Ex warning) |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{| | {{PageAuthor|sunjammer}} | ||
<div style="border: 1px solid #404000; background-color:#f8f880; color:#000; padding:0.5em;"><b>Warning: </b>This only works correctly for systems with less than 4 GiB RAM. New code should [[System Information|try GlobalMemoryStatusEx first]].</div> | |||
== Description == | == Description == | ||
KiCHiK came up with this NSIS code to check free RAM using the System plugin ([http://forums.winamp.com/showthread.php?postid=868438&highlight=SystemAlloc#post868438 original forum posting]) | KiCHiK came up with this NSIS code to check free RAM using the System plugin ([http://forums.winamp.com/showthread.php?postid=868438&highlight=SystemAlloc#post868438 original forum posting]) | ||
Line 23: | Line 23: | ||
DetailPrint "Free virtual: $9 Bytes" | DetailPrint "Free virtual: $9 Bytes" | ||
</highlight-nsis> | </highlight-nsis> | ||
[[Category:System Plugin Examples]] |
Latest revision as of 20:44, 28 September 2022
Author: sunjammer (talk, contrib) |
Warning: This only works correctly for systems with less than 4 GiB RAM. New code should try GlobalMemoryStatusEx first.
Description
KiCHiK came up with this NSIS code to check free RAM using the System plugin (original forum posting)
The Function
System::Alloc 32 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"