internal virtual int GetMemoryUsage()
{
int memoryUsage = 0;
if (this.hashArrays != null)
{
// HashArray capacity is instance-specific.
foreach (HashArray ha in this.hashArrays)
{
// Each has 2 capacity-length arrays of ints.
memoryUsage += (ha.capacity * 2 * 4) + 4;
}
}
if (this.labelRepository != null)
{
// All blocks are the same size.
int blockSize = this.labelRepository.blockSize;
// Each block has room for blockSize UTF-16 chars.
int actualBlockSize = (blockSize * 2) + 4;
memoryUsage += this.labelRepository.blocks.Count * actualBlockSize;
memoryUsage += 8; // Two int values for array as a whole.
}
if (this.collisionMap != null)
{
memoryUsage += this.collisionMap.GetMemoryUsage();
}
return memoryUsage;
}