internal char[] GetCharBlock()
{
lock (this)
{
int size = freeCharBlocks.Count;
char[] c;
if (0 == size)
{
numBytesAlloc += CHAR_BLOCK_SIZE * CHAR_NUM_BYTE;
c = new char[CHAR_BLOCK_SIZE];
}
else
{
c = freeCharBlocks[size - 1];
freeCharBlocks.RemoveAt(size - 1);
}
// We always track allocations of char blocks, for now,
// because nothing that skips allocation tracking
// (currently only term vectors) uses its own char
// blocks.
numBytesUsed += CHAR_BLOCK_SIZE * CHAR_NUM_BYTE;
System.Diagnostics.Debug.Assert(numBytesUsed <= numBytesAlloc);
return c;
}
}