Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QV4::BlockAllocator Struct Reference

#include <qv4mm_p.h>

+ Collaboration diagram for QV4::BlockAllocator:

Public Types

enum  { NumBins = 8 }
 

Public Member Functions

 BlockAllocator (ChunkAllocator *chunkAllocator, ExecutionEngine *engine)
 
HeapItemallocate (size_t size, bool forceAllocation=false)
 
size_t totalSlots () const
 
size_t allocatedMem () const
 
size_t usedMem () const
 
void sweep ()
 
void freeAll ()
 
void resetBlackBits ()
 

Static Public Member Functions

static size_t binForSlots (size_t nSlots)
 

Public Attributes

HeapItemnextFree = nullptr
 
size_t nFree = 0
 
size_t usedSlotsAfterLastSweep = 0
 
HeapItemfreeBins [NumBins]
 
ChunkAllocatorchunkAllocator
 
ExecutionEngineengine
 
std::vector< Chunk * > chunks
 
uintallocationStats = nullptr
 

Detailed Description

Definition at line 101 of file qv4mm_p.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
NumBins 

Definition at line 108 of file qv4mm_p.h.

Constructor & Destructor Documentation

◆ BlockAllocator()

QV4::BlockAllocator::BlockAllocator ( ChunkAllocator * chunkAllocator,
ExecutionEngine * engine )
inline

Definition at line 102 of file qv4mm_p.h.

References freeBins.

Member Function Documentation

◆ allocate()

HeapItem * QV4::BlockAllocator::allocate ( size_t size,
bool forceAllocation = false )

Definition at line 445 of file qv4mm.cpp.

References done, engine, QV4::HeapItem::freeData, i, Q_ASSERT, and Q_V4_PROFILE_ALLOC.

◆ allocatedMem()

size_t QV4::BlockAllocator::allocatedMem ( ) const
inline

Definition at line 120 of file qv4mm_p.h.

References chunks, and QV4::Chunk::DataSize.

Referenced by QV4::MemoryManager::getAllocatedMem(), QV4::MemoryManager::runGC(), and QV4::MemoryManager::updateUnmanagedHeapSizeGCLimit().

+ Here is the caller graph for this function:

◆ binForSlots()

static size_t QV4::BlockAllocator::binForSlots ( size_t nSlots)
inlinestatic

Definition at line 110 of file qv4mm_p.h.

References NumBins.

◆ freeAll()

void QV4::BlockAllocator::freeAll ( )

Definition at line 583 of file qv4mm.cpp.

References engine, and Q_V4_PROFILE_DEALLOC.

Referenced by QV4::MemoryManager::~MemoryManager().

+ Here is the caller graph for this function:

◆ resetBlackBits()

void QV4::BlockAllocator::resetBlackBits ( )

Definition at line 593 of file qv4mm.cpp.

Referenced by QV4::MemoryManager::~MemoryManager(), and QV4::MemoryManager::sweep().

+ Here is the caller graph for this function:

◆ sweep()

void QV4::BlockAllocator::sweep ( )

Definition at line 555 of file qv4mm.cpp.

Referenced by QV4::MemoryManager::sweep().

+ Here is the caller graph for this function:

◆ totalSlots()

size_t QV4::BlockAllocator::totalSlots ( ) const
inline

Definition at line 116 of file qv4mm_p.h.

References QV4::Chunk::AvailableSlots, and chunks.

◆ usedMem()

size_t QV4::BlockAllocator::usedMem ( ) const
inline

Definition at line 123 of file qv4mm_p.h.

References chunks, and QV4::Chunk::SlotSize.

Referenced by QV4::MemoryManager::getUsedMem(), and QV4::MemoryManager::updateUnmanagedHeapSizeGCLimit().

+ Here is the caller graph for this function:

Member Data Documentation

◆ allocationStats

uint* QV4::BlockAllocator::allocationStats = nullptr

Definition at line 142 of file qv4mm_p.h.

Referenced by QV4::MemoryManager::MemoryManager().

◆ chunkAllocator

ChunkAllocator* QV4::BlockAllocator::chunkAllocator

Definition at line 139 of file qv4mm_p.h.

◆ chunks

std::vector<Chunk *> QV4::BlockAllocator::chunks

Definition at line 141 of file qv4mm_p.h.

Referenced by allocatedMem(), QV4::MemoryManager::runGC(), totalSlots(), and usedMem().

◆ engine

ExecutionEngine* QV4::BlockAllocator::engine

Definition at line 140 of file qv4mm_p.h.

◆ freeBins

HeapItem* QV4::BlockAllocator::freeBins[NumBins]

Definition at line 138 of file qv4mm_p.h.

Referenced by BlockAllocator().

◆ nextFree

HeapItem* QV4::BlockAllocator::nextFree = nullptr

Definition at line 135 of file qv4mm_p.h.

◆ nFree

size_t QV4::BlockAllocator::nFree = 0

Definition at line 136 of file qv4mm_p.h.

◆ usedSlotsAfterLastSweep

size_t QV4::BlockAllocator::usedSlotsAfterLastSweep = 0

Definition at line 137 of file qv4mm_p.h.

Referenced by QV4::MemoryManager::sweep().


The documentation for this struct was generated from the following files: