Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

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.

.
Summary
returns the current memory usage for the CE Win device
Summary
TODO - a short description

C# Signature:

[DllImport("coredll", EntryPoint="GlobalMemoryStatus", SetLastError=false)]
internal static extern void GlobalMemoryStatusCE(out MemoryStatus msce);

VB Signature:

<DllImport("coredll.dll")> Private Shared Function GlobalMemoryStatus(ByRef ms As MEMORYSTATUS) As Int32
End Function
Declare Function GlobalMemoryStatus Lib "coredll.dll" (TODO) As TODO

User-Defined Types:

None.

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

Alternative Managed API:

Do you know one? Please contribute it!

C# MemoryStatus 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.

Notes:

Taken from openNetCF in OpenNETCF.Win32.Core

Tips & Tricks:

Please add some!

you can ignore the dwTotalPageFile and dwAvailPageFile as they are not supported

under CE

Sample Code:

Please add some!

    ''' <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

Documentation

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).

 
Access PInvoke.net directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version
Revisions