Reading Free RAM
Rob Heaton (274) 515 posts |
Can anyone please tell me how to read the current free RAM from BASIC? I’ve been using OS_DynamicArea 5, which will only return a maximum of 2GB. I can’t get OS_DynamicArea 27 to return anything like the free RAM. SYS”OS_DynamicArea”,27,-1 TO r0%,r1%,r2% On my Pinebook Pro with 3.6GB RAM free, this prints; Any help would be greatly appreciated! |
David Pitt (9872) 362 posts |
REM >ReadFree REM get page size in bytes and number of pages SYS "OS_ReadMemMapInfo" TO size%,no% PRINT size%,no% REM convert size to KB to keep within 32bit maths sizek%=size% DIV 1024 SYS "OS_DynamicArea" ,27,-1 TO r0%,r1%,freepages% PRINT "Number of free pages ";freepages% PRINT "Free size ";freepages% * sizek%;"KB" END |
Rick Murray (539) 13806 posts |
Could also do |
Rob Heaton (274) 515 posts |
Thanks David & Rick! |