Class SoftReferenceOptions
Allows to configure behavior of SoftReference<T>.
Inherited Members
Namespace: DotNext.Runtime
Assembly: DotNext.dll
Syntax
public class SoftReferenceOptions
Properties
| Edit this page View SourceCollectionCount
Indicates how many collections can the referenced object survive.
Declaration
public int CollectionCount { get; init; }
Property Value
Type | Description |
---|---|
int |
Default
Gets default options.
Declaration
public static SoftReferenceOptions Default { get; }
Property Value
Type | Description |
---|---|
SoftReferenceOptions |
MemoryLimit
Gets the memory limit for Gen2 used as a trigger to release a reference to the object.
Declaration
public long MemoryLimit { get; init; }
Property Value
Type | Description |
---|---|
long |
Remarks
If soft reference detects that Gen2 occupies more memory than the limit then the referenced object will be marked as available for garbage collection regardless of CollectionCount configuration value.
MemoryThreshold
Gets the memory threshold.
Declaration
public double MemoryThreshold { get; init; }
Property Value
Type | Description |
---|---|
double | The memory threshold; must be in range (0, 1]. |
Remarks
The default is 1.