Class ApproximateMemoryUsage
- Namespace
- RocksDbNet
- Assembly
- RocksDb.Net.dll
How much memory a set of databases and caches is using, at one moment.
public sealed class ApproximateMemoryUsage : RocksDbHandle, IDisposable
- Inheritance
-
ApproximateMemoryUsage
- Implements
- Inherited Members
Remarks
A snapshot, not a live view: each figure is read once when this is created and does not move afterwards. Take another to see a change.
What this adds, and what it does not. Every individual figure below
is already reachable without it —
Usage for a cache,
rocksdb.cur-size-all-mem-tables and
rocksdb.estimate-table-readers-mem through
GetAggregatedPropertyInt(string) for a database. What is new
is the aggregation: one snapshot spanning several databases and several
caches, which otherwise means writing the loop and knowing which properties
to sum. If you are asking about one database, the properties are the simpler
answer and this is not worth reaching for.
Properties
CacheTotal
Bytes held by the caches that were added.
public ulong CacheTotal { get; }
Property Value
MemTableReadersTotal
Bytes held by table readers: index and filter blocks, mainly.
public ulong MemTableReadersTotal { get; }
Property Value
MemTableTotal
Bytes held by memtables, flushed and unflushed.
public ulong MemTableTotal { get; }
Property Value
MemTableUnflushed
Bytes held by memtables whose contents are not yet in an SST file.
public ulong MemTableUnflushed { get; }
Property Value
Remarks
The part of MemTableTotal that a flush would release.
Methods
DisposeHandle()
Releases the native handle. Called during disposal.
protected override void DisposeHandle()
Remarks
Protected rather than public: it destroys the native object without marking this instance disposed or clearing the handle, so calling it from outside and then disposing normally would free the same pointer twice. It was the most Dispose-looking member on the type. Callers want Dispose().
Take(MemoryConsumers)
Takes a snapshot over consumers.
public static ApproximateMemoryUsage Take(MemoryConsumers consumers)
Parameters
consumersMemoryConsumers
Returns
Remarks
The consumers may be disposed once this returns: the figures are read here, not later.