Class RamUsageEstimator
Estimates the size (memory representation) of .NET objects.
@lucene.internal
Inheritance
Assembly: DistributedLucene.Net.dll
Syntax
public sealed class RamUsageEstimator : object
Fields
Name | Description |
---|---|
NUM_BYTES_ARRAY_HEADER | Number of bytes to represent an array header (no content, but with alignments). |
NUM_BYTES_BOOLEAN | |
NUM_BYTES_BYTE | |
NUM_BYTES_CHAR | |
NUM_BYTES_DOUBLE | |
NUM_BYTES_INT16 | NOTE: This was NUM_BYTES_SHORT in Lucene |
NUM_BYTES_INT32 | NOTE: This was NUM_BYTES_INT in Lucene |
NUM_BYTES_INT64 | NOTE: This was NUM_BYTES_LONG in Lucene |
NUM_BYTES_OBJECT_ALIGNMENT | A constant specifying the object alignment boundary inside the .NET runtime. Objects will always take a full multiple of this constant, possibly wasting some space. |
NUM_BYTES_OBJECT_HEADER | Number of bytes to represent an object header (no fields, no alignments). |
NUM_BYTES_OBJECT_REF | Number of bytes this .NET runtime uses to represent an object reference. |
NUM_BYTES_SINGLE | NOTE: This was NUM_BYTES_FLOAT in Lucene |
ONE_GB | One gigabyte bytes. |
ONE_KB | One kilobyte bytes. |
ONE_MB | One megabyte bytes. |
Methods
Name | Description |
---|---|
AlignObjectSize(Int64) | Aligns an object size to be the next multiple of NUM_BYTES_OBJECT_ALIGNMENT. |
HumanReadableUnits(Int64) | Returns |
HumanReadableUnits(Int64, IFormatProvider) | Returns |
HumanSizeOf(Object) | Return a human-readable size of a given object. |
ShallowSizeOf(Object) | Estimates a "shallow" memory usage of the given object. For arrays, this will be the memory taken by array storage (no subreferences will be followed). For objects, this will be the memory taken by the fields. .NET object alignments are also applied. |
ShallowSizeOfInstance(Type) | Returns the shallow instance size in bytes an instance of the given class would occupy. This works with all conventional classes and primitive types, but not with arrays (the size then depends on the number of elements and varies from object to object). |
SizeOf(Boolean[]) | Returns the size in bytes of the bool[] object. |
SizeOf(Byte[]) | Returns the size in bytes of the byte[] object. |
SizeOf(Char[]) | Returns the size in bytes of the char[] object. |
SizeOf(Double[]) | Returns the size in bytes of the double[] object. |
SizeOf(Int16[]) | Returns the size in bytes of the short[] object. |
SizeOf(Int32[]) | Returns the size in bytes of the int[] object. |
SizeOf(Int64[]) | Returns the size in bytes of the long[] object. |
SizeOf(Object) | Estimates the RAM usage by the given object. It will walk the object tree and sum up all referenced objects. Resource Usage: this method internally uses a set of every object seen during traversals so it does allocate memory (it isn't side-effect free). After the method exits, this memory should be GCed. |
SizeOf(SByte[]) | Returns the size in bytes of the sbyte[] object. |
SizeOf(Single[]) | Returns the size in bytes of the float[] object. |
SizeOf(UInt16[]) | Returns the size in bytes of the ushort[] object. |
SizeOf(UInt32[]) | Returns the size in bytes of the uint[] object. |
SizeOf(UInt64[]) | Returns the size in bytes of the ulong[] object. |