internal int[] GetIntBlock(bool trackAllocations)
{
lock (this)
{
int size = freeIntBlocks.Count;
int[] b;
if (0 == size)
{
// Always record a block allocated, even if
// trackAllocations is false. This is necessary
// because this block will be shared between
// things that don't track allocations (term
// vectors) and things that do (freq/prox
// postings).
numBytesAlloc += INT_BLOCK_SIZE * INT_NUM_BYTE;
b = new int[INT_BLOCK_SIZE];
}
else
{
b = freeIntBlocks[size - 1];
freeIntBlocks.RemoveAt(size - 1);
}
if (trackAllocations)
numBytesUsed += INT_BLOCK_SIZE * INT_NUM_BYTE;
System.Diagnostics.Debug.Assert(numBytesUsed <= numBytesAlloc);
return b;
}
}