Type a page name and press Enter. You'll jump to the page if it exists, or you can create it if it doesn't.
To create a page in a module other than coredll, prefix the name with the module name and a period.
GlobalMemoryStatus (coredll)
coredll is for smart devices, not desktop Windows. Therefore, this information only applies to code using the .NET Compact Framework. To see if information for GlobalMemoryStatus in other DLLs exists, click on Find References to the right.
<DllImport("coredll.dll")> Private Shared Function GlobalMemoryStatus(ByRef ms As MEMORYSTATUS) As Int32
End Function
User-Defined Types:
vb Memorystatus structure
Public Structure MEMORYSTATUS
''' <summary>
''' size of the structure
''' </summary>
''' <remarks> ms.dwLength = Marshal.SizeOf(ms)</remarks>
Public dwLength As Int32
''' <summary>
''' % of used
''' </summary>
''' <remarks></remarks>
Public dwMemoryLoad As Int32
''' <summary>
''' bytes of total ram
''' </summary>
''' <remarks></remarks>
Public dwTotalPhys As Int32
''' <summary>
''' bytes of currently available ram
''' </summary>
''' <remarks></remarks>
Public dwAvailPhys As Int32
''' <summary>
''' bytes in pageing (? not normally supported in Ce)
''' </summary>
''' <remarks></remarks>
Public dwTotalPageFile As Int32
''' <summary>
''' bytes in pageing (? not normally supported in Ce)
''' </summary>
''' <remarks></remarks>
Public dwAvailPageFile As Int32
''' <summary>
''' total virtual bytes can be used
''' </summary>
''' <remarks></remarks>
Public dwTotalVirtual As Int32
''' <summary>
''' current virtual bytes available
''' </summary>
''' <remarks></remarks>
Public dwAvailVirtual As Int32
End Structure
[StructLayout(LayoutKind.Sequential)]
internal struct MemoryStatus {
/// <summary>
/// Size of the structure
/// </summary>
public int dwLength { get; set; }
/// <summary>
/// Percentage of memory used
/// </summary>
public int dwMemoryLoad { get; set; }
/// <summary>
/// Total size in bytes of physical memory
/// </summary>
public int dwTotalPhys { get; set; }
/// <summary>
/// Available size in bytes of physical memory
/// </summary>
public int dwAvailPhys { get; set; }
/// <summary>
/// Total size in bytes of page file memory
/// </summary>
public int dwTotalPageFile { get; set; }
/// <summary>
/// Available size in bytes of page file memory
/// </summary>
public int dwAvailPageFile { get; set; }
/// <summary>
/// Total size in bytes of virtual memory
/// </summary>
public int dwTotalVirtual {get; set; }
/// <summary>
/// Available size in bytes of virtual memory
/// </summary>
public int dwAvailVirtual { get; set; }
}
Alternative Managed API:
GC.GetTotalMemory() can return the current memory in GC but no other details.
you can ignore the dwTotalPageFile and dwAvailPageFile as they are not supported
under CE
Sample Code:
''' <summary>
''' gets the memory status of the current ce platform
''' </summary>
''' <returns></returns>
''' <remarks></remarks>
Public Shared Function GetMemory() As MEMORYSTATUS
Dim ms As MEMORYSTATUS
ms.dwLength = Marshal.SizeOf(ms)
GlobalMemoryStatus(ms)
Return ms
End Function
TODO - a short description
4/17/2009 8:17:26 AM - anonymous
Please edit this page!
Do you have...
helpful tips or sample code to share for using this API in managed code?
corrections to the existing content?
variations of the signature you want to share?
additional languages you want to include?
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).