Memory status

A

Arnaldo Fuziy

The function below returns some strange numbers that I can't figure out
their meaning: returns 163208757280 e 80906463648210944...

<StructLayout(LayoutKind.Sequential)> _
Public Class Memory_Status
Public Length As Long
Public MemoryLoad As Long
Public TotalPhysical As Long
Public AvailPhysical As Long
Public TotalPageFile As Long
Public AvailPageFile As Long
Public TotalVirtual As Long
Public AvailVirtual As Long
End Class

<DllImport("coredll.dll", EntryPoint:="GlobalMemoryStatus",
SetLastError:=True)> _
Public Sub GlobalMemoryStatus(ByVal ms As Memory_Status)
End Sub

Can anyone help us identify what are these numbers?

Thanks,

Arnaldo.
 
C

Chris Tacke, eMVP

I'd have to check since I don't recall offhand, but the Physical/Virtual
members either report bytes free or pages free. Probably pages.

-Chris
 
A

Arnaldo Fuziy

We had this impression either and even tried to use the GetMemoryDivision to
retrieve the page size to make the necessary calculations but it returns
NotSupportedException

after we try to run it... Do you know how we should calculate the effective
size in bytes?

Tks,

Arnaldo.
 
A

Arnaldo Fuziy

In bytes, how much memory is the number returning from the function?
Length: 163208757280
MemoryLoad: 80906463648210944
TotalPhysical: 0
AvailPhysical: 123004564856111104

Tks,
 
C

Chris Tacke, eMVP

Thos numbers are invalid, and looking again at your code it's because you're
using Long. In the CF Long is 64bit. Use Integer instead. I'm actually
quite surprised this ran.
 
G

Geoff Schwab [MSFT]

Hi Arnaldo,

Hmmm. What device are you testing this on? Does the emulator return
strange values as well? The reason I ask is the proverbial OEM note appears
in the help description of this function:

Note This API is part of the complete Windows CE OS package as provided by
Microsoft. The functionality of a particular platform is determined by the
original equipment manufacturer (OEM) and some devices may not support this
API.

The code works for me on an iPAQ and when I run the code on the emulator I
get:

dwAvailPageFile 0
dwAvailPhys 17129472 - 16.33 MB
dwAvailVirtual 30277632 - 28.9 MB
dwLength 32
dwMemoryLoad 26
dwTotalPageFile 0
dwTotalPhys 22900736 - 21.8 MB
dwTotalVirtual 33554432 - 32 MB

GetSystemMemoryDivision returns 1 as the result with:
uint storePages = 5591;
uint ramPages = 5591;
uint pageSize = 4096;


--
Geoff Schwab
Program Manager
Excell Data Corporation
http://msdn.com/mobility

This posting is provided "AS IS" with no warranties, and confers no
 
A

Arnaldo Fuziy

Now it works... Can't believe I was so dumb not to pay attention to that...

Tks very much,

Arnaldo.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top