using System; using System.Runtime.CompilerServices; using System.Runtime.ConstrainedExecution; namespace System { /// Controls the system garbage collector, a service that automatically reclaims unused memory. /// 2 // Token: 0x0200066E RID: 1646 public static class GC { /// Gets the maximum number of generations that the system currently supports. /// A value that ranges from zero to the maximum number of supported generations. /// 1 // Token: 0x17000B9F RID: 2975 // (get) Token: 0x06003E63 RID: 15971 public static extern int MaxGeneration { [MethodImpl(MethodImplOptions.InternalCall)] get; } // Token: 0x06003E64 RID: 15972 [MethodImpl(MethodImplOptions.InternalCall)] private static extern void InternalCollect(int generation); /// Forces an immediate garbage collection of all generations. /// 1 // Token: 0x06003E65 RID: 15973 RVA: 0x000D4244 File Offset: 0x000D2444 public static void Collect() { GC.InternalCollect(GC.MaxGeneration); } /// Forces an immediate garbage collection from generation zero through a specified generation. /// The number of the oldest generation that garbage collection can be performed on. /// /// is not valid. /// 1 // Token: 0x06003E66 RID: 15974 RVA: 0x000D4250 File Offset: 0x000D2450 public static void Collect(int generation) { if (generation < 0) { throw new ArgumentOutOfRangeException("generation"); } GC.InternalCollect(generation); } /// Forces a garbage collection from generation zero through a specified generation, at a time specified by a value. /// The number of the oldest generation that garbage collection can be performed on. /// One of the values. /// /// is not valid.-or- is not one of the values. // Token: 0x06003E67 RID: 15975 RVA: 0x000D426C File Offset: 0x000D246C [MonoDocumentationNote("mode parameter ignored")] public static void Collect(int generation, GCCollectionMode mode) { GC.Collect(generation); } /// Returns the current generation number of the specified object. /// The current generation number of . /// The object that generation information is retrieved for. /// 1 // Token: 0x06003E68 RID: 15976 [MethodImpl(MethodImplOptions.InternalCall)] public static extern int GetGeneration(object obj); /// Returns the current generation number of the target of a specified weak reference. /// The current generation number of the target of . /// A that refers to the target object whose generation number is to be determined. /// Garbage collection has already been performed on . /// 1 // Token: 0x06003E69 RID: 15977 RVA: 0x000D4274 File Offset: 0x000D2474 public static int GetGeneration(WeakReference wo) { object target = wo.Target; if (target == null) { throw new ArgumentException(); } return GC.GetGeneration(target); } /// Retrieves the number of bytes currently thought to be allocated. A parameter indicates whether this method can wait a short interval before returning, to allow the system to collect garbage and finalize objects. /// A number that is the best available approximation of the number of bytes currently allocated in managed memory. /// true to indicate that this method can wait for garbage collection to occur before returning; otherwise, false. /// 1 // Token: 0x06003E6A RID: 15978 [MethodImpl(MethodImplOptions.InternalCall)] public static extern long GetTotalMemory(bool forceFullCollection); /// References the specified object, which makes it ineligible for garbage collection from the start of the current routine to the point where this method is called. /// The object to reference. /// 1 // Token: 0x06003E6B RID: 15979 [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] [MethodImpl(MethodImplOptions.InternalCall)] public static extern void KeepAlive(object obj); /// Requests that the system call the finalizer for the specified object for which has previously been called. /// The object that a finalizer must be called for. /// /// is null. /// 1 // Token: 0x06003E6C RID: 15980 [MethodImpl(MethodImplOptions.InternalCall)] public static extern void ReRegisterForFinalize(object obj); /// Requests that the system not call the finalizer for the specified object. /// The object that a finalizer must not be called for. /// /// is null. /// 1 // Token: 0x06003E6D RID: 15981 [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] [MethodImpl(MethodImplOptions.InternalCall)] public static extern void SuppressFinalize(object obj); /// Suspends the current thread until the thread that is processing the queue of finalizers has emptied that queue. /// 1 // Token: 0x06003E6E RID: 15982 [MethodImpl(MethodImplOptions.InternalCall)] public static extern void WaitForPendingFinalizers(); /// Returns the number of times garbage collection has occurred for the specified generation of objects. /// The number of times garbage collection has occurred for the specified generation since the process was started. /// The generation of objects for which the garbage collection count is to be determined. /// /// is less than 0. /// 1 // Token: 0x06003E6F RID: 15983 [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] [MethodImpl(MethodImplOptions.InternalCall)] public static extern int CollectionCount(int generation); // Token: 0x06003E70 RID: 15984 [MethodImpl(MethodImplOptions.InternalCall)] private static extern void RecordPressure(long bytesAllocated); /// Informs the runtime of a large allocation of unmanaged memory that should be taken into account when scheduling garbage collection. /// The incremental amount of unmanaged memory that has been allocated. /// /// is less than or equal to 0.-or-On a 32-bit computer, is larger than . /// 1 /// /// /// // Token: 0x06003E71 RID: 15985 RVA: 0x000D429C File Offset: 0x000D249C public static void AddMemoryPressure(long bytesAllocated) { GC.RecordPressure(bytesAllocated); } /// Informs the runtime that unmanaged memory has been released and no longer needs to be taken into account when scheduling garbage collection. /// The amount of unmanaged memory that has been released. /// /// is less than or equal to 0. -or- On a 32-bit computer, is larger than . /// 1 /// /// /// // Token: 0x06003E72 RID: 15986 RVA: 0x000D42A4 File Offset: 0x000D24A4 public static void RemoveMemoryPressure(long bytesAllocated) { GC.RecordPressure(-bytesAllocated); } } }