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:

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 getUsedMem () 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 ()
void collectFromJSStack (MarkStack *markStack) const
void sweep (bool lastSweep=false, ClassDestroyStatsCallback classCountPtr=nullptr)
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
QVector< Value * > m_pendingFreedObjectWrapperValue
Heap::MapObjectweakMaps = nullptr
Heap::SetObjectweakSets = nullptr
std::unique_ptr< GCStateMachinegcStateMachine {nullptr}
std::unique_ptr< MarkStackm_markStack {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   maxReservedMem = 0 
   size_t   maxAllocatedMem = 0 
   size_t   maxUsedMem = 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 196 of file qv4mm_p.h.

Member Enumeration Documentation

◆ Blockness

Enumerator
Unblocked 
NormalBlocked 
InCriticalSection 

Definition at line 443 of file qv4mm_p.h.

Constructor & Destructor Documentation

◆ MemoryManager()

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

Definition at line 962 of file qv4mm.cpp.

◆ ~MemoryManager()

QV4::MemoryManager::~MemoryManager ( )

Definition at line 1482 of file qv4mm.cpp.

Member Function Documentation

◆ align()

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

Definition at line 209 of file qv4mm_p.h.

◆ alloc()

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

Definition at line 329 of file qv4mm_p.h.

◆ allocate()

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

Definition at line 320 of file qv4mm_p.h.

◆ allocateObject() [1/3]

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

Definition at line 284 of file qv4mm_p.h.

◆ allocateObject() [2/3]

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

Definition at line 268 of file qv4mm_p.h.

◆ allocateObject() [3/3]

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

Definition at line 278 of file qv4mm_p.h.

◆ allocData()

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

Definition at line 1066 of file qv4mm.cpp.

◆ allocIC()

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

Definition at line 355 of file qv4mm_p.h.

◆ allocManaged() [1/6]

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

Definition at line 259 of file qv4mm_p.h.

◆ allocManaged() [2/6]

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

Definition at line 233 of file qv4mm_p.h.

◆ allocManaged() [3/6]

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

Definition at line 245 of file qv4mm_p.h.

◆ allocManaged() [4/6]

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

Definition at line 251 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 221 of file qv4mm_p.h.

References QV4::Heap::InternalClass::vtable.

◆ allocManaged() [6/6]

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

Definition at line 239 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 304 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 312 of file qv4mm_p.h.

◆ allocObjectWithMemberData()

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

Definition at line 1081 of file qv4mm.cpp.

◆ allocString()

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

expects size to be aligned

Definition at line 1052 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 294 of file qv4mm_p.h.

◆ changeUnmanagedHeapSizeUsage()

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

Definition at line 349 of file qv4mm_p.h.

◆ cleanupDeletedQObjectWrappersInSweep()

void QV4::MemoryManager::cleanupDeletedQObjectWrappersInSweep ( )

Definition at line 1228 of file qv4mm.cpp.

◆ collectFromJSStack()

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

Definition at line 1529 of file qv4mm.cpp.

◆ dumpStats()

void QV4::MemoryManager::dumpStats ( ) const

Definition at line 1513 of file qv4mm.cpp.

◆ getAllocatedMem()

size_t QV4::MemoryManager::getAllocatedMem ( ) const

Definition at line 1437 of file qv4mm.cpp.

◆ getLargeItemsMem()

size_t QV4::MemoryManager::getLargeItemsMem ( ) const

Definition at line 1442 of file qv4mm.cpp.

◆ getUsedMem()

size_t QV4::MemoryManager::getUsedMem ( ) const

Definition at line 1432 of file qv4mm.cpp.

◆ isAboveUnmanagedHeapLimit()

bool QV4::MemoryManager::isAboveUnmanagedHeapLimit ( )
inline

Definition at line 385 of file qv4mm_p.h.

◆ markStack()

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

Definition at line 368 of file qv4mm_p.h.

◆ onEventLoop()

void QV4::MemoryManager::onEventLoop ( )

Definition at line 1166 of file qv4mm.cpp.

◆ registerWeakMap()

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

Definition at line 1470 of file qv4mm.cpp.

◆ registerWeakSet()

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

Definition at line 1476 of file qv4mm.cpp.

◆ runFullGC()

void QV4::MemoryManager::runFullGC ( )

Definition at line 1331 of file qv4mm.cpp.

◆ runGC()

void QV4::MemoryManager::runGC ( )

Definition at line 1339 of file qv4mm.cpp.

◆ setGCTimeLimit()

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

Definition at line 1182 of file qv4mm.cpp.

◆ sweep()

void QV4::MemoryManager::sweep ( bool lastSweep = false,
ClassDestroyStatsCallback classCountPtr = nullptr )

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

◆ updateUnmanagedHeapSizeGCLimit()

void QV4::MemoryManager::updateUnmanagedHeapSizeGCLimit ( )

Definition at line 1447 of file qv4mm.cpp.

◆ GCCriticalSection

template<typename ToBeMarked>
friend struct GCCriticalSection
friend

Definition at line 205 of file qv4mm_p.h.

Member Data Documentation

◆ aggressiveGC

bool QV4::MemoryManager::aggressiveGC = false

Definition at line 445 of file qv4mm_p.h.

◆ allocationCount

int QV4::MemoryManager::allocationCount = 0

Definition at line 450 of file qv4mm_p.h.

◆ allocations

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

Definition at line 457 of file qv4mm_p.h.

◆ blockAllocator

BlockAllocator QV4::MemoryManager::blockAllocator

Definition at line 427 of file qv4mm_p.h.

◆ chunkAllocator

ChunkAllocator* QV4::MemoryManager::chunkAllocator

Definition at line 426 of file qv4mm_p.h.

◆ crossValidateIncrementalGC

bool QV4::MemoryManager::crossValidateIncrementalGC = false

Definition at line 446 of file qv4mm_p.h.

◆ engine

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

Definition at line 425 of file qv4mm_p.h.

◆ gcBlocked

Blockness QV4::MemoryManager::gcBlocked = Unblocked

Definition at line 444 of file qv4mm_p.h.

◆ gcCollectorStats

bool QV4::MemoryManager::gcCollectorStats = false

Definition at line 448 of file qv4mm_p.h.

◆ gcStateMachine

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

Definition at line 436 of file qv4mm_p.h.

◆ gcStats

bool QV4::MemoryManager::gcStats = false

Definition at line 447 of file qv4mm_p.h.

◆ hugeItemAllocator

HugeItemAllocator QV4::MemoryManager::hugeItemAllocator

Definition at line 429 of file qv4mm_p.h.

◆ icAllocator

BlockAllocator QV4::MemoryManager::icAllocator

Definition at line 428 of file qv4mm_p.h.

◆ lastAllocRequestedSlots

size_t QV4::MemoryManager::lastAllocRequestedSlots = 0

Definition at line 451 of file qv4mm_p.h.

◆ m_markStack

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

Definition at line 437 of file qv4mm_p.h.

◆ m_pendingFreedObjectWrapperValue

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

Definition at line 432 of file qv4mm_p.h.

◆ m_persistentValues

PersistentValueStorage* QV4::MemoryManager::m_persistentValues

Definition at line 430 of file qv4mm_p.h.

◆ m_weakValues

PersistentValueStorage* QV4::MemoryManager::m_weakValues

Definition at line 431 of file qv4mm_p.h.

◆ maxAllocatedMem

size_t QV4::MemoryManager::maxAllocatedMem = 0

Definition at line 455 of file qv4mm_p.h.

◆ maxReservedMem

size_t QV4::MemoryManager::maxReservedMem = 0

Definition at line 454 of file qv4mm_p.h.

◆ maxUsedMem

size_t QV4::MemoryManager::maxUsedMem = 0

Definition at line 456 of file qv4mm_p.h.

◆ [struct]

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

◆ unmanagedHeapSize

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

Definition at line 439 of file qv4mm_p.h.

◆ unmanagedHeapSizeGCLimit

std::size_t QV4::MemoryManager::unmanagedHeapSizeGCLimit

Definition at line 440 of file qv4mm_p.h.

◆ usedSlotsAfterLastFullSweep

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

Definition at line 441 of file qv4mm_p.h.

◆ weakMaps

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

Definition at line 433 of file qv4mm_p.h.

◆ weakSets

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

Definition at line 434 of file qv4mm_p.h.


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