Example #1
0
void Deallocator::scavenge()
{
    processObjectLog();
    
    std::lock_guard<StaticMutex> lock(PerProcess<Heap>::mutex());
    Heap* heap = PerProcess<Heap>::getFastCase();
    
    for (auto& smallLineCache : m_smallLineCaches) {
        while (smallLineCache.size())
            heap->deallocateSmallLine(lock, smallLineCache.pop());
    }
    while (m_mediumLineCache.size())
        heap->deallocateMediumLine(lock, m_mediumLineCache.pop());
}
Example #2
0
void Deallocator::deallocateSlowCase(void* object)
{
    BASSERT(!deallocateFastCase(object));

    if (!object)
        return;

    if (isSmallOrMedium(object)) {
        processObjectLog();
        m_objectLog.push(object);
        return;
    }

    BeginTag* beginTag = LargeChunk::beginTag(object);
    if (!beginTag->isXLarge())
        return deallocateLarge(object);
    
    return deallocateXLarge(object);
}
Example #3
0
void Deallocator::deallocateSlowCase(void* object)
{
    if (!m_isBmallocEnabled) {
        free(object);
        return;
    }

    if (!object)
        return;

    std::lock_guard<StaticMutex> lock(PerProcess<Heap>::mutex());
    if (PerProcess<Heap>::getFastCase()->isLarge(lock, object)) {
        PerProcess<Heap>::getFastCase()->deallocateLarge(lock, object);
        return;
    }

    if (m_objectLog.size() == m_objectLog.capacity())
        processObjectLog(lock);

    m_objectLog.push(object);
}
void Deallocator::deallocateSlowCase(void* object)
{
    BASSERT(!deallocateFastCase(object));
    
    if (!m_isBmallocEnabled) {
        free(object);
        return;
    }

    BASSERT(objectType(nullptr) == XLarge);
    if (!object)
        return;

    if (isSmallOrMedium(object)) {
        processObjectLog();
        m_objectLog.push(object);
        return;
    }

    if (!isXLarge(object))
        return deallocateLarge(object);
    
    return deallocateXLarge(object);
}
void Deallocator::scavenge()
{
    if (m_isBmallocEnabled)
        processObjectLog();
}
Example #6
0
void Deallocator::processObjectLog()
{
    std::lock_guard<StaticMutex> lock(PerProcess<Heap>::mutex());
    processObjectLog(lock);
}