Пример #1
0
SmallLine* Deallocator::allocateSmallLine(size_t smallSizeClass)
{
    SmallLineCache& smallLineCache = m_smallLineCaches[smallSizeClass];
    if (!smallLineCache.size()) {
        std::lock_guard<StaticMutex> lock(PerProcess<Heap>::mutex());
        Heap* heap = PerProcess<Heap>::getFastCase();

        while (smallLineCache.size() != smallLineCache.capacity())
            smallLineCache.push(heap->allocateSmallLine(lock, smallSizeClass));
    }

    return smallLineCache.pop();
}