Пример #1
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);
}
Пример #2
0
void Deallocator::processObjectLog()
{
    std::lock_guard<StaticMutex> lock(PerProcess<Heap>::mutex());
    
    for (auto object : m_objectLog) {
        if (isSmall(object)) {
            SmallLine* line = SmallLine::get(object);
            if (!line->deref(lock))
                continue;
            deallocateSmallLine(lock, line);
        } else {
            BASSERT(isSmallOrMedium(object));
            MediumLine* line = MediumLine::get(object);
            if (!line->deref(lock))
                continue;
            deallocateMediumLine(lock, line);
        }
    }
    
    m_objectLog.clear();
}
Пример #3
0
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);
}