Qt 6.x
The Qt SDK
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 34 of file qv4mm_p.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
NumBins 

Definition at line 41 of file qv4mm_p.h.

Constructor & Destructor Documentation

◆ BlockAllocator()

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

Definition at line 35 of file qv4mm_p.h.

References freeBins.

Member Function Documentation

◆ allocate()

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

Definition at line 443 of file qv4mm.cpp.

References QV4::HeapItem::availableSlots, done, engine, QV4::Chunk::first(), QV4::HeapItem::freeData, i, QV4::HeapItem::next, Q_ASSERT, and Q_V4_PROFILE_ALLOC.

+ Here is the call graph for this function:

◆ allocatedMem()

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

Definition at line 53 of file qv4mm_p.h.

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

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

+ Here is the caller graph for this function:

◆ binForSlots()

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

Definition at line 43 of file qv4mm_p.h.

References NumBins.

◆ freeAll()

void QV4::BlockAllocator::freeAll ( )

Definition at line 581 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 591 of file qv4mm.cpp.

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

+ Here is the caller graph for this function:

◆ sweep()

void QV4::BlockAllocator::sweep ( )

Definition at line 553 of file qv4mm.cpp.

◆ totalSlots()

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

Definition at line 49 of file qv4mm_p.h.

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

◆ usedMem()

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

Definition at line 56 of file qv4mm_p.h.

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

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

+ Here is the caller graph for this function:

Member Data Documentation

◆ allocationStats

uint* QV4::BlockAllocator::allocationStats = nullptr

Definition at line 75 of file qv4mm_p.h.

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

◆ chunkAllocator

ChunkAllocator* QV4::BlockAllocator::chunkAllocator

Definition at line 72 of file qv4mm_p.h.

◆ chunks

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

Definition at line 74 of file qv4mm_p.h.

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

◆ engine

ExecutionEngine* QV4::BlockAllocator::engine

Definition at line 73 of file qv4mm_p.h.

◆ freeBins

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

Definition at line 71 of file qv4mm_p.h.

Referenced by BlockAllocator().

◆ nextFree

HeapItem* QV4::BlockAllocator::nextFree = nullptr

Definition at line 68 of file qv4mm_p.h.

◆ nFree

size_t QV4::BlockAllocator::nFree = 0

Definition at line 69 of file qv4mm_p.h.

◆ usedSlotsAfterLastSweep

size_t QV4::BlockAllocator::usedSlotsAfterLastSweep = 0

Definition at line 70 of file qv4mm_p.h.

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


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