Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QV4::MemoryManager Class Reference

#include <qv4mm_p.h>

Collaboration diagram for QV4::MemoryManager:

Classes

struct  ObjectsForCompilationUnit

Public Types

enum  Blockness : quint8 { Unblocked , NormalBlocked , InCriticalSection }

Public Member Functions

 MemoryManager (ExecutionEngine *engine)
 ~MemoryManager ()
template<typename ManagedType>
ManagedType::Data * allocManaged (std::size_t size, Heap::InternalClass *ic)
template<typename ManagedType>
ManagedType::Data * allocManaged (Heap::InternalClass *ic)
template<typename ManagedType>
ManagedType::Data * allocManaged (std::size_t size, InternalClass *ic)
template<typename ManagedType>
ManagedType::Data * allocManaged (InternalClass *ic)
template<typename ManagedType>
ManagedType::Data * allocManaged (std::size_t size)
template<typename ManagedType>
ManagedType::Data * allocManaged ()
template<typename ObjectType>
ObjectType::Data * allocateObject (Heap::InternalClass *ic)
template<typename ObjectType>
ObjectType::Data * allocateObject (InternalClass *ic)
template<typename ObjectType>
ObjectType::Data * allocateObject ()
template<typename ManagedType, typename Arg1>
ManagedType::Data * allocWithStringData (std::size_t unmanagedSize, Arg1 &&arg1)
template<typename ObjectType, typename... Args>
ObjectType::Data * allocObject (Heap::InternalClass *ic, Args &&... args)
template<typename ObjectType, typename... Args>
ObjectType::Data * allocObject (InternalClass *ic, Args &&... args)
template<typename ObjectType, typename... Args>
ObjectType::Data * allocate (Args &&... args)
template<typename ManagedType, typename... Args>
ManagedType::Data * alloc (Args &&... args)
void runGC ()
bool tryForceGCCompletion ()
void runFullGC ()
void dumpStats () const
size_t getRegularItemsMem () const
size_t getAllocatedMem () const
size_t getLargeItemsMem () const
void changeUnmanagedHeapSizeUsage (qptrdiff delta)
void updateUnmanagedHeapSizeGCLimit ()
template<typename ManagedType>
ManagedType::Data * allocIC ()
void registerWeakMap (Heap::MapObject *map)
void registerWeakSet (Heap::SetObject *set)
void onEventLoop ()
void setGCTimeLimit (int timeMs)
MarkStackmarkStack ()
std::vector< QObject * > findObjectsForCompilationUnits (std::vector< QQmlRefPointer< CompiledData::CompilationUnit > > &&units)
void collectFromJSStack (MarkStack *markStack) const
void sweep (bool lastSweep=false)
void cleanupDeletedQObjectWrappersInSweep ()
bool isAboveUnmanagedHeapLimit ()

Static Public Member Functions

static constexpr std::size_t align (std::size_t size)

Public Attributes

QV4::ExecutionEngineengine
ChunkAllocatorchunkAllocator
BlockAllocator blockAllocator
BlockAllocator icAllocator
HugeItemAllocator hugeItemAllocator
PersistentValueStoragem_persistentValues
PersistentValueStoragem_weakValues
QList< Value * > m_pendingFreedObjectWrapperValue
Heap::MapObjectweakMaps = nullptr
Heap::SetObjectweakSets = nullptr
std::unique_ptr< GCStateMachinegcStateMachine {nullptr}
std::unique_ptr< MarkStackm_markStack {nullptr}
ObjectsForCompilationUnitm_recordedObjects = nullptr
std::size_t unmanagedHeapSize = 0
std::size_t unmanagedHeapSizeGCLimit
std::size_t usedSlotsAfterLastFullSweep = 0
Blockness gcBlocked = Unblocked
bool aggressiveGC = false
bool crossValidateIncrementalGC = false
bool gcStats = false
bool gcCollectorStats = false
int allocationCount = 0
size_t lastAllocRequestedSlots = 0
struct { 
   size_t   maxAllocatedMem = 0 
   size_t   maxUsedBeforeGC = 0 
   size_t   maxUsedAfterGC = 0 
   uint   allocations [BlockAllocator::NumBins
statistics

Protected Member Functions

Heap::BaseallocString (std::size_t unmanagedSize)
 expects size to be aligned
Heap::BaseallocData (std::size_t size)
Heap::Object * allocObjectWithMemberData (const QV4::VTable *vtable, uint nMembers)

Friends

template<typename ToBeMarked>
struct GCCriticalSection

Detailed Description

Definition at line 247 of file qv4mm_p.h.

Member Enumeration Documentation

◆ Blockness

Enumerator
Unblocked 
NormalBlocked 
InCriticalSection 

Definition at line 505 of file qv4mm_p.h.

Constructor & Destructor Documentation

◆ MemoryManager()

QV4::MemoryManager::MemoryManager ( ExecutionEngine * engine)

Definition at line 958 of file qv4mm.cpp.

◆ ~MemoryManager()

QV4::MemoryManager::~MemoryManager ( )

Definition at line 1460 of file qv4mm.cpp.

Member Function Documentation

◆ align()

constexpr std::size_t QV4::MemoryManager::align ( std::size_t size)
inlinestaticconstexpr

Definition at line 260 of file qv4mm_p.h.

◆ alloc()

template<typename ManagedType, typename... Args>
ManagedType::Data * QV4::MemoryManager::alloc ( Args &&... args)
inline

Definition at line 380 of file qv4mm_p.h.

◆ allocate()

template<typename ObjectType, typename... Args>
ObjectType::Data * QV4::MemoryManager::allocate ( Args &&... args)
inline

Definition at line 371 of file qv4mm_p.h.

◆ allocateObject() [1/3]

template<typename ObjectType>
ObjectType::Data * QV4::MemoryManager::allocateObject ( )
inline

Definition at line 335 of file qv4mm_p.h.

◆ allocateObject() [2/3]

template<typename ObjectType>
ObjectType::Data * QV4::MemoryManager::allocateObject ( Heap::InternalClass * ic)
inline

Definition at line 319 of file qv4mm_p.h.

◆ allocateObject() [3/3]

template<typename ObjectType>
ObjectType::Data * QV4::MemoryManager::allocateObject ( InternalClass * ic)
inline

Definition at line 329 of file qv4mm_p.h.

◆ allocData()

Heap::Base * QV4::MemoryManager::allocData ( std::size_t size)
protected

Definition at line 1062 of file qv4mm.cpp.

◆ allocIC()

template<typename ManagedType>
ManagedType::Data * QV4::MemoryManager::allocIC ( )
inline

Definition at line 406 of file qv4mm_p.h.

◆ allocManaged() [1/6]

template<typename ManagedType>
ManagedType::Data * QV4::MemoryManager::allocManaged ( )
inline

Definition at line 310 of file qv4mm_p.h.

◆ allocManaged() [2/6]

template<typename ManagedType>
ManagedType::Data * QV4::MemoryManager::allocManaged ( Heap::InternalClass * ic)
inline

Definition at line 284 of file qv4mm_p.h.

◆ allocManaged() [3/6]

template<typename ManagedType>
ManagedType::Data * QV4::MemoryManager::allocManaged ( InternalClass * ic)
inline

Definition at line 296 of file qv4mm_p.h.

◆ allocManaged() [4/6]

template<typename ManagedType>
ManagedType::Data * QV4::MemoryManager::allocManaged ( std::size_t size)
inline

Definition at line 302 of file qv4mm_p.h.

◆ allocManaged() [5/6]

template<typename ManagedType>
ManagedType::Data * QV4::MemoryManager::allocManaged ( std::size_t size,
Heap::InternalClass * ic )
inline

Definition at line 272 of file qv4mm_p.h.

References QV4::Q_STATIC_ASSERT(), and QV4::Heap::InternalClass::vtable.

Here is the call graph for this function:

◆ allocManaged() [6/6]

template<typename ManagedType>
ManagedType::Data * QV4::MemoryManager::allocManaged ( std::size_t size,
InternalClass * ic )
inline

Definition at line 290 of file qv4mm_p.h.

◆ allocObject() [1/2]

template<typename ObjectType, typename... Args>
ObjectType::Data * QV4::MemoryManager::allocObject ( Heap::InternalClass * ic,
Args &&... args )
inline

Definition at line 355 of file qv4mm_p.h.

◆ allocObject() [2/2]

template<typename ObjectType, typename... Args>
ObjectType::Data * QV4::MemoryManager::allocObject ( InternalClass * ic,
Args &&... args )
inline

Definition at line 363 of file qv4mm_p.h.

◆ allocObjectWithMemberData()

Heap::Object * QV4::MemoryManager::allocObjectWithMemberData ( const QV4::VTable * vtable,
uint nMembers )
protected

Definition at line 1077 of file qv4mm.cpp.

◆ allocString()

Heap::Base * QV4::MemoryManager::allocString ( std::size_t unmanagedSize)
protected

expects size to be aligned

Definition at line 1048 of file qv4mm.cpp.

◆ allocWithStringData()

template<typename ManagedType, typename Arg1>
ManagedType::Data * QV4::MemoryManager::allocWithStringData ( std::size_t unmanagedSize,
Arg1 && arg1 )
inline

Definition at line 345 of file qv4mm_p.h.

◆ changeUnmanagedHeapSizeUsage()

void QV4::MemoryManager::changeUnmanagedHeapSizeUsage ( qptrdiff delta)
inline

Definition at line 400 of file qv4mm_p.h.

◆ cleanupDeletedQObjectWrappersInSweep()

void QV4::MemoryManager::cleanupDeletedQObjectWrappersInSweep ( )

Definition at line 1220 of file qv4mm.cpp.

◆ collectFromJSStack()

void QV4::MemoryManager::collectFromJSStack ( MarkStack * markStack) const

Definition at line 1507 of file qv4mm.cpp.

◆ dumpStats()

void QV4::MemoryManager::dumpStats ( ) const

Definition at line 1491 of file qv4mm.cpp.

◆ findObjectsForCompilationUnits()

std::vector< QObject * > QV4::MemoryManager::findObjectsForCompilationUnits ( std::vector< QQmlRefPointer< CompiledData::CompilationUnit > > && units)

Definition at line 1634 of file qv4mm.cpp.

◆ getAllocatedMem()

size_t QV4::MemoryManager::getAllocatedMem ( ) const

Definition at line 1415 of file qv4mm.cpp.

◆ getLargeItemsMem()

size_t QV4::MemoryManager::getLargeItemsMem ( ) const

Definition at line 1420 of file qv4mm.cpp.

◆ getRegularItemsMem()

size_t QV4::MemoryManager::getRegularItemsMem ( ) const

Definition at line 1410 of file qv4mm.cpp.

◆ isAboveUnmanagedHeapLimit()

bool QV4::MemoryManager::isAboveUnmanagedHeapLimit ( )
inline

Definition at line 439 of file qv4mm_p.h.

◆ markStack()

MarkStack * QV4::MemoryManager::markStack ( )
inline

Definition at line 419 of file qv4mm_p.h.

◆ onEventLoop()

void QV4::MemoryManager::onEventLoop ( )

Definition at line 1158 of file qv4mm.cpp.

◆ registerWeakMap()

void QV4::MemoryManager::registerWeakMap ( Heap::MapObject * map)

Definition at line 1448 of file qv4mm.cpp.

◆ registerWeakSet()

void QV4::MemoryManager::registerWeakSet ( Heap::SetObject * set)

Definition at line 1454 of file qv4mm.cpp.

◆ runFullGC()

void QV4::MemoryManager::runFullGC ( )

Definition at line 1323 of file qv4mm.cpp.

◆ runGC()

void QV4::MemoryManager::runGC ( )

Definition at line 1331 of file qv4mm.cpp.

◆ setGCTimeLimit()

void QV4::MemoryManager::setGCTimeLimit ( int timeMs)

Definition at line 1174 of file qv4mm.cpp.

◆ sweep()

void QV4::MemoryManager::sweep ( bool lastSweep = false)

Definition at line 1179 of file qv4mm.cpp.

◆ tryForceGCCompletion()

bool QV4::MemoryManager::tryForceGCCompletion ( )

Precondition: Incremental garbage collection must be currently active Finishes incremental garbage collection, unless in a critical section Code entering a critical section is expected to check if we need to force a gc completion, and to trigger the gc again if necessary when exiting the critcial section. Returns true if the gc cycle completed, false otherwise.

Definition at line 1302 of file qv4mm.cpp.

◆ updateUnmanagedHeapSizeGCLimit()

void QV4::MemoryManager::updateUnmanagedHeapSizeGCLimit ( )

Definition at line 1425 of file qv4mm.cpp.

◆ GCCriticalSection

template<typename ToBeMarked>
friend struct GCCriticalSection
friend

Definition at line 256 of file qv4mm_p.h.

Member Data Documentation

◆ aggressiveGC

bool QV4::MemoryManager::aggressiveGC = false

Definition at line 507 of file qv4mm_p.h.

◆ allocationCount

int QV4::MemoryManager::allocationCount = 0

Definition at line 513 of file qv4mm_p.h.

◆ allocations

uint QV4::MemoryManager::allocations[BlockAllocator::NumBins]

Definition at line 521 of file qv4mm_p.h.

◆ blockAllocator

BlockAllocator QV4::MemoryManager::blockAllocator

Definition at line 486 of file qv4mm_p.h.

◆ chunkAllocator

ChunkAllocator* QV4::MemoryManager::chunkAllocator

Definition at line 485 of file qv4mm_p.h.

◆ crossValidateIncrementalGC

bool QV4::MemoryManager::crossValidateIncrementalGC = false

Definition at line 508 of file qv4mm_p.h.

◆ engine

QV4::ExecutionEngine* QV4::MemoryManager::engine

Definition at line 484 of file qv4mm_p.h.

◆ gcBlocked

Blockness QV4::MemoryManager::gcBlocked = Unblocked

Definition at line 506 of file qv4mm_p.h.

◆ gcCollectorStats

bool QV4::MemoryManager::gcCollectorStats = false

Definition at line 510 of file qv4mm_p.h.

◆ gcStateMachine

std::unique_ptr<GCStateMachine> QV4::MemoryManager::gcStateMachine {nullptr}

Definition at line 495 of file qv4mm_p.h.

◆ gcStats

bool QV4::MemoryManager::gcStats = false

Definition at line 509 of file qv4mm_p.h.

◆ hugeItemAllocator

HugeItemAllocator QV4::MemoryManager::hugeItemAllocator

Definition at line 488 of file qv4mm_p.h.

◆ icAllocator

BlockAllocator QV4::MemoryManager::icAllocator

Definition at line 487 of file qv4mm_p.h.

◆ lastAllocRequestedSlots

size_t QV4::MemoryManager::lastAllocRequestedSlots = 0

Definition at line 514 of file qv4mm_p.h.

◆ m_markStack

std::unique_ptr<MarkStack> QV4::MemoryManager::m_markStack {nullptr}

Definition at line 496 of file qv4mm_p.h.

◆ m_pendingFreedObjectWrapperValue

QList<Value *> QV4::MemoryManager::m_pendingFreedObjectWrapperValue

Definition at line 491 of file qv4mm_p.h.

◆ m_persistentValues

PersistentValueStorage* QV4::MemoryManager::m_persistentValues

Definition at line 489 of file qv4mm_p.h.

◆ m_recordedObjects

ObjectsForCompilationUnit* QV4::MemoryManager::m_recordedObjects = nullptr

Definition at line 499 of file qv4mm_p.h.

◆ m_weakValues

PersistentValueStorage* QV4::MemoryManager::m_weakValues

Definition at line 490 of file qv4mm_p.h.

◆ maxAllocatedMem

size_t QV4::MemoryManager::maxAllocatedMem = 0

Definition at line 518 of file qv4mm_p.h.

◆ maxUsedAfterGC

size_t QV4::MemoryManager::maxUsedAfterGC = 0

Definition at line 520 of file qv4mm_p.h.

◆ maxUsedBeforeGC

size_t QV4::MemoryManager::maxUsedBeforeGC = 0

Definition at line 519 of file qv4mm_p.h.

◆ [struct]

struct { ... } QV4::MemoryManager::statistics

◆ unmanagedHeapSize

std::size_t QV4::MemoryManager::unmanagedHeapSize = 0

Definition at line 501 of file qv4mm_p.h.

◆ unmanagedHeapSizeGCLimit

std::size_t QV4::MemoryManager::unmanagedHeapSizeGCLimit

Definition at line 502 of file qv4mm_p.h.

◆ usedSlotsAfterLastFullSweep

std::size_t QV4::MemoryManager::usedSlotsAfterLastFullSweep = 0

Definition at line 503 of file qv4mm_p.h.

◆ weakMaps

Heap::MapObject* QV4::MemoryManager::weakMaps = nullptr

Definition at line 492 of file qv4mm_p.h.

◆ weakSets

Heap::SetObject* QV4::MemoryManager::weakSets = nullptr

Definition at line 493 of file qv4mm_p.h.


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