Desktop Functions: Smart Device Functions:
|
Search Results for "MEMORYSTATUSEX" in [All]Structures1: MEMORYSTATUS The CLR offer us no way to tell us that memory is getting tight. Many think this API provides the best solution. This is mentioned by Jeffrey Richter in his book 'CLR via C#' ISBN: 0-7356-2163-2. It is useful in determining if your system is under excessive memory load by looking at the dwMemoryLoad member of the MEMORYSTATUSEX structure. If this value is > 80 (per Mr. Richter in his discussion of Garbage Collection), it is an indication that you might want to consider converting some strong references into weak references. Remember that a weakreference type will be collected when Generation 0 is full, so it is not a good technique for caching (as many seem to think).
public class MEMORYSTATUSEX
/// Size of the structure, in bytes. You must set this member before calling GlobalMemoryStatusEx.
/// Initializes a new instance of the <see cref="T:MEMORYSTATUSEX"/> class.
public MEMORYSTATUSEX()
this.dwLength = (uint)Marshal.SizeOf(typeof(NativeMethods.MEMORYSTATUSEX));
/// memory, including extended memory. The GlobalMemoryStatusEx function stores
/// <remarks>MEMORYSTATUSEX reflects the state of memory at the time of the call. It also
public struct MEMORYSTATUSEX
/// calling GlobalMemoryStatusEx.</summary>
Public Class MEMORYSTATUSEX
''' Initializes a new instance of the <see cref="T:MEMORYSTATUSEX" /> class.
Me.dwLength = CType(Marshal.SizeOf(GetType(MEMORYSTATUSEX)), UInt32)
''' Size of the structure, in bytes. You must set this member before calling GlobalMemoryStatusEx. The CLR offer us no way to tell us that memory is getting tight. Many think this API provides the best solution. This is mentioned by Jeffrey Richter in his book 'CLR via C#' ISBN: 0-7356-2163-2. It is useful in determining if your system is under excessive memory load by looking at the dwMemoryLoad member of the MEMORYSTATUSEX structure. If this value is > 80 (per Mr. Richter in his discussion of Garbage Collection), it is an indication that you might want to consider converting some strong references into weak references. Remember that a weakreference type will be collected when Generation 0 is full, so it is not a good technique for caching (as many seem to think).
public class MEMORYSTATUSEX
/// Size of the structure, in bytes. You must set this member before calling GlobalMemoryStatusEx.
/// Initializes a new instance of the <see cref="T:MEMORYSTATUSEX"/> class.
public MEMORYSTATUSEX()
this.dwLength = (uint)Marshal.SizeOf(typeof(NativeMethods.MEMORYSTATUSEX));
Public Class MEMORYSTATUSEX
''' Initializes a new instance of the <see cref="T:MEMORYSTATUSEX" /> class.
Me.dwLength = CType(Marshal.SizeOf(GetType(MEMORYSTATUSEX)), UInt32)
''' Size of the structure, in bytes. You must set this member before calling GlobalMemoryStatusEx. kernel32
static extern bool GlobalMemoryStatusEx( [In,Out] MEMORYSTATUSEX lpBuffer); //Used to use ref with comment below
//comment: most probably caused by MEMORYSTATUSEX being declared as a class
// Also See Alternate Version Of [MEMORYSTATUSEX] Defined As A Structure.
[DllImport( "kernel32.dll", CharSet = CharSet.Auto, EntryPoint = "GlobalMemoryStatusEx", SetLastError = true )]
static extern bool _GlobalMemoryStatusEx( ref MEMORYSTATUSEX lpBuffer );
Private Declare Function GlobalMemoryStatusEx Lib "kernel32" Alias "GlobalMemoryStatusEx" ( _
<[In](), Out()>ByVal lpBuffer As MEMORYSTATUSEX _ The CLR offers us no way to tell if memory is getting tight. Many think that this API provides the best solution. This is mentioned by Jeffrey Richter in his book 'CLR via C#' ISBN: 0-7356-2163-2. It is useful in determining if your system is under excessive memory load by looking at the dwMemoryLoad member of the MEMORYSTATUSEX structure. If this value is > 80 (per Mr. Richter in his discussion of Garbage Collection), it is an indication that you might want to consider converting some strong references into weak references. Remember that a weakreference type will be collected when Generation 0 is full, so it is not a good technique for caching (as many seem to think).
private MEMORYSTATUSEX msex;
msex = new MEMORYSTATUSEX();
if (GlobalMemoryStatusEx(msex)) {
throw new Exception("Unable to initalize the GlobalMemoryStatusEx API");
private class MEMORYSTATUSEX
public MEMORYSTATUSEX()
this.dwLength = (uint) Marshal.SizeOf(typeof( MEMORYSTATUSEX ));
static extern bool GlobalMemoryStatusEx( [In, Out] MEMORYSTATUSEX lpBuffer);
public static bool GlobalMemoryStatus( ref MEMORYSTATUSEX msex )
msex.dwLength = (uint)Marshal.SizeOf( typeof( MEMORYSTATUSEX ) );
return( _GlobalMemoryStatusEx( ref msex ) );
static extern bool GlobalMemoryStatusEx( [In,Out] MEMORYSTATUSEX lpBuffer); //Used to use ref with comment below
//comment: most probably caused by MEMORYSTATUSEX being declared as a class
// Also See Alternate Version Of [MEMORYSTATUSEX] Structure With
[DllImport( "kernel32.dll", CharSet = CharSet.Auto, EntryPoint = "GlobalMemoryStatusEx", SetLastError = true )]
static extern bool _GlobalMemoryStatusEx( ref MEMORYSTATUSEX lpBuffer );
Private Declare Function GlobalMemoryStatusEx Lib "kernel32" Alias "GlobalMemoryStatusEx" ( _
<[In](), Out()>ByVal lpBuffer As MEMORYSTATUSEX _ The CLR offers us no way to tell if memory is getting tight. Many think that this API provides the best solution. This is mentioned by Jeffrey Richter in his book 'CLR via C#' ISBN: 0-7356-2163-2. It is useful in determining if your system is under excessive memory load by looking at the dwMemoryLoad member of the MEMORYSTATUSEX structure. If this value is > 80 (per Mr. Richter in his discussion of Garbage Collection), it is an indication that you might want to consider converting some strong references into weak references. Remember that a weakreference type will be collected when Generation 0 is full, so it is not a good technique for caching (as many seem to think).
private MEMORYSTATUSEX msex;
msex = new MEMORYSTATUSEX();
if (GlobalMemoryStatusEx(msex)) {
throw new Exception("Unable to initalize the GlobalMemoryStatusEx API");
private class MEMORYSTATUSEX
public MEMORYSTATUSEX()
this.dwLength = (uint) Marshal.SizeOf(typeof( MEMORYSTATUSEX ));
static extern bool GlobalMemoryStatusEx( [In, Out] MEMORYSTATUSEX lpBuffer);
public static bool GlobalMemoryStatus( ref MEMORYSTATUSEX msex )
msex.dwLength = (uint)Marshal.SizeOf( typeof( MEMORYSTATUSEX ) );
return( _GlobalMemoryStatusEx( ref msex ) ); |