![]() |
Qt 6.x
The Qt SDK
|
#include <qv4mm_p.h>
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 (std::size_t size, InternalClass *ic) |
template<typename ManagedType > | |
ManagedType::Data * | allocManaged (std::size_t size) |
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 () |
void | dumpStats () const |
size_t | getUsedMem () const |
size_t | getAllocatedMem () const |
size_t | getLargeItemsMem () const |
void | changeUnmanagedHeapSizeUsage (qptrdiff delta) |
template<typename ManagedType > | |
ManagedType::Data * | allocIC () |
void | registerWeakMap (Heap::MapObject *map) |
void | registerWeakSet (Heap::SetObject *set) |
Static Public Member Functions | |
static constexpr std::size_t | align (std::size_t size) |
Public Attributes | ||
QV4::ExecutionEngine * | engine | |
ChunkAllocator * | chunkAllocator | |
BlockAllocator | blockAllocator | |
BlockAllocator | icAllocator | |
HugeItemAllocator | hugeItemAllocator | |
PersistentValueStorage * | m_persistentValues | |
PersistentValueStorage * | m_weakValues | |
QVector< Value * > | m_pendingFreedObjectWrapperValue | |
Heap::MapObject * | weakMaps = nullptr | |
Heap::SetObject * | weakSets = nullptr | |
std::size_t | unmanagedHeapSize = 0 | |
std::size_t | unmanagedHeapSizeGCLimit | |
std::size_t | usedSlotsAfterLastFullSweep = 0 | |
bool | gcBlocked = false | |
bool | aggressiveGC = 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::Base * | allocString (std::size_t unmanagedSize) |
expects size to be aligned | |
Heap::Base * | allocData (std::size_t size) |
Heap::Object * | allocObjectWithMemberData (const QV4::VTable *vtable, uint nMembers) |
QV4::MemoryManager::MemoryManager | ( | ExecutionEngine * | engine | ) |
Definition at line 675 of file qv4mm.cpp.
References QV4::BlockAllocator::allocationStats, blockAllocator, gcStats, and statistics.
QV4::MemoryManager::~MemoryManager | ( | ) |
Definition at line 1106 of file qv4mm.cpp.
References blockAllocator, chunkAllocator, dumpStats(), QV4::BlockAllocator::freeAll(), QV4::HugeItemAllocator::freeAll(), hugeItemAllocator, icAllocator, m_persistentValues, and m_weakValues.
|
inlinestaticconstexpr |
Definition at line 117 of file qv4mm_p.h.
Referenced by QV4::MemberData::allocate(), allocObjectWithMemberData(), and allocString().
|
inline |
Definition at line 208 of file qv4mm_p.h.
Referenced by QV4::RuntimeHelpers::addHelper(), QV4::RegExpObject::builtinExec(), QV4::QmlContext::create(), QV4::RegExpPrototype::execFirstMatch(), QV4::StringPrototype::method_slice(), and QV4::ExecutionContext::newWithContext().
|
inline |
Definition at line 199 of file qv4mm_p.h.
Referenced by QV4::ExecutionEngine::ExecutionEngine(), QQuickV4ParticleData::QQuickV4ParticleData(), allocData(), allocString(), QV4::NodeList::create(), QV4::NamedNodeMap::create(), QV4::QQmlTypeWrapper::create(), QV4::QQmlTypeWrapper::create(), QV4::QmlListWrapper::create(), QV4::QmlListWrapper::create(), QV4::QmlListWrapper::create(), QV4::Node::create(), QV4::QmlContext::create(), QV4::QObjectMethod::create(), QV4::QObjectMethod::create(), QV4::QQmlSqlDatabaseWrapper::create(), QQuickJSContext2DPrototype::create(), QV4::FunctionObject::createBuiltinFunction(), QV4::Heap::Sequence::detached(), QV4::Promise::ReactionHandler::executeResolveThenable(), QQmlDMListAccessorData::get(), QQmlDelegateModelGroup::get(), QQmlListModel::get(), QV4::NodePrototype::getProto(), QQmlComponent::incubateObject(), VDMAbstractItemModelDataType::initializeConstructor(), QV4::Document::load(), QQuickJSContext2DPrototype::method_createConicalGradient(), QQuickJSContext2DPrototype::method_createLinearGradient(), QQuickJSContext2DPrototype::method_createPattern(), QQuickJSContext2DPrototype::method_createRadialGradient(), QV4::StringPrototype::method_iterator(), QV4::PromiseCtor::method_race(), QV4::Proxy::method_revocable(), QV4::ExecutionEngine::newArrayBuffer(), QV4::ExecutionEngine::newArrayBuffer(), QV4::ExecutionEngine::newArrayIteratorObject(), QV4::ExecutionEngine::newArrayObject(), QV4::ExecutionEngine::newArrayObject(), QV4::ExecutionEngine::newArrayObject(), QV4::ExecutionEngine::newBooleanObject(), QV4::ExecutionEngine::newDateObject(), QV4::ExecutionEngine::newDateObject(), QV4::ExecutionEngine::newDateObject(), QV4::ExecutionEngine::newDateObject(), QV4::ExecutionEngine::newDateObject(), QV4::ExecutionEngine::newForInIteratorObject(), QV4::ExecutionEngine::newMapIteratorObject(), QV4::ExecutionEngine::newNumberObject(), QV4::ExecutionEngine::newObject(), QV4::ExecutionEngine::newPromiseObject(), QV4::ExecutionEngine::newPromiseObject(), QV4::ExecutionEngine::newRegExpObject(), QV4::ExecutionEngine::newSetIteratorObject(), QV4::ExecutionEngine::newStringObject(), QV4::ExecutionEngine::newUrlObject(), QV4::ExecutionEngine::newUrlSearchParamsObject(), QV4::ExecutionEngine::newVariantObject(), qt_add_qmlxmlhttprequest(), qt_create_image_data(), QV4::Proxy::virtualCallAsConstructor(), QV4::QQmlTypeWrapper::virtualGet(), QV4::QQmlTypeWrapper::virtualResolveLookupGetter(), and QQmlLocale::wrap().
|
inline |
|
inline |
|
inline |
|
protected |
Definition at line 717 of file qv4mm.cpp.
References allocate(), allocationCount, blockAllocator, gcBlocked, lastAllocRequestedSlots, Q_ASSERT, QV4::Chunk::SlotSize, and QV4::Chunk::SlotSizeShift.
Referenced by allocObjectWithMemberData().
|
inline |
Definition at line 229 of file qv4mm_p.h.
Referenced by QV4::ExecutionEngine::ExecutionEngine(), and QV4::ExecutionEngine::newClass().
|
inline |
|
inline |
Definition at line 121 of file qv4mm_p.h.
References d, engine, Q_ASSERT, Q_STATIC_ASSERT, and QV4::Heap::InternalClass::vtable.
Referenced by QV4::ExecutionContext::cloneBlockContext(), QV4::ExecutionEngine::initRootContext(), QV4::ExecutionEngine::newArrayObject(), QV4::ExecutionContext::newBlockContext(), QV4::ExecutionContext::newCallContext(), QV4::ArrayData::realloc(), and QV4::GeneratorFunction::virtualCall().
|
inline |
|
inline |
Definition at line 183 of file qv4mm_p.h.
Referenced by QV4::ExecutionEngine::ExecutionEngine(), QV4::ExecutionEngine::newArrayObject(), QV4::ExecutionEngine::newObject(), QV4::ExecutionEngine::newSymbolObject(), and QV4::ScriptFunction::virtualCallAsConstructor().
|
inline |
|
protected |
Definition at line 739 of file qv4mm.cpp.
References align(), QV4::HugeItemAllocator::allocate(), allocData(), QV4::HeapItem::as(), QV4::HeapItem::chunk(), QV4::EngineBase::Class_MemberData, QV4::Chunk::clearBit(), QV4::Chunk::DataSize, engine, hugeItemAllocator, QV4::VTable::inlinePropertyOffset, QV4::EngineBase::internalClasses(), QV4::VTable::nInlineProperties, o, Q_ASSERT, QV4::Chunk::setBit(), and QV4::Chunk::SlotSizeShift.
|
protected |
expects size to be aligned
Definition at line 696 of file qv4mm.cpp.
References align(), allocate(), allocationCount, blockAllocator, gcBlocked, lastAllocRequestedSlots, QV4::Chunk::SlotSizeShift, and unmanagedHeapSize.
|
inline |
Definition at line 173 of file qv4mm_p.h.
References engine, o, and Q_ASSERT.
Referenced by QV4::ExecutionEngine::newIdentifier(), and QV4::ExecutionEngine::newString().
void QV4::MemoryManager::dumpStats | ( | ) | const |
Definition at line 1125 of file qv4mm.cpp.
References gcStats, i, QV4::BlockAllocator::NumBins, qDebug, QV4::Chunk::SlotSizeShift, and statistics.
Referenced by ~MemoryManager().
size_t QV4::MemoryManager::getAllocatedMem | ( | ) | const |
Definition at line 1084 of file qv4mm.cpp.
References QV4::BlockAllocator::allocatedMem(), blockAllocator, hugeItemAllocator, icAllocator, and QV4::HugeItemAllocator::usedMem().
Referenced by runGC().
size_t QV4::MemoryManager::getLargeItemsMem | ( | ) | const |
Definition at line 1089 of file qv4mm.cpp.
References hugeItemAllocator, and QV4::HugeItemAllocator::usedMem().
Referenced by runGC().
size_t QV4::MemoryManager::getUsedMem | ( | ) | const |
Definition at line 1079 of file qv4mm.cpp.
References blockAllocator, icAllocator, and QV4::BlockAllocator::usedMem().
Referenced by runGC().
void QV4::MemoryManager::registerWeakMap | ( | Heap::MapObject * | map | ) |
void QV4::MemoryManager::registerWeakSet | ( | Heap::SetObject * | set | ) |
void QV4::MemoryManager::runGC | ( | ) |
Definition at line 965 of file qv4mm.cpp.
References aggressiveGC, QV4::BlockAllocator::allocatedMem(), allocationCount, QString::arg(), blockAllocator, QSet< T >::cbegin(), QSet< T >::cend(), QV4::BlockAllocator::chunks, QHash< Key, T >::constBegin(), QHash< Key, T >::constEnd(), QV4::dumpBins(), QString::fromLatin1(), gcBlocked, gcCollectorStats, gcStats, getAllocatedMem(), getLargeItemsMem(), getUsedMem(), hugeItemAllocator, icAllocator, QV4::increaseFreedCountForClass(), it, lastAllocRequestedSlots, QV4::markStackSize, QString::number(), Q_ASSERT, qDebug, qMax(), QV4::BlockAllocator::resetBlackBits(), QV4::HugeItemAllocator::resetBlackBits(), QHash< Key, T >::size(), statistics, unmanagedHeapSize, unmanagedHeapSizeGCLimit, QV4::BlockAllocator::usedMem(), usedSlotsAfterLastFullSweep, and QV4::BlockAllocator::usedSlotsAfterLastSweep.
Referenced by QJSEngine::collectGarbage().
bool QV4::MemoryManager::aggressiveGC = false |
int QV4::MemoryManager::allocationCount = 0 |
Definition at line 312 of file qv4mm_p.h.
Referenced by allocData(), allocString(), and runGC().
uint QV4::MemoryManager::allocations[BlockAllocator::NumBins] |
BlockAllocator QV4::MemoryManager::blockAllocator |
Definition at line 294 of file qv4mm_p.h.
Referenced by MemoryManager(), ~MemoryManager(), allocData(), allocString(), getAllocatedMem(), getUsedMem(), and runGC().
ChunkAllocator* QV4::MemoryManager::chunkAllocator |
Definition at line 293 of file qv4mm_p.h.
Referenced by ~MemoryManager().
QV4::ExecutionEngine* QV4::MemoryManager::engine |
Definition at line 292 of file qv4mm_p.h.
Referenced by allocObjectWithMemberData().
bool QV4::MemoryManager::gcBlocked = false |
Definition at line 307 of file qv4mm_p.h.
Referenced by allocData(), allocString(), and runGC().
bool QV4::MemoryManager::gcCollectorStats = false |
bool QV4::MemoryManager::gcStats = false |
Definition at line 309 of file qv4mm_p.h.
Referenced by MemoryManager(), dumpStats(), and runGC().
HugeItemAllocator QV4::MemoryManager::hugeItemAllocator |
Definition at line 296 of file qv4mm_p.h.
Referenced by ~MemoryManager(), allocObjectWithMemberData(), getAllocatedMem(), getLargeItemsMem(), and runGC().
BlockAllocator QV4::MemoryManager::icAllocator |
Definition at line 295 of file qv4mm_p.h.
Referenced by ~MemoryManager(), getAllocatedMem(), getUsedMem(), and runGC().
size_t QV4::MemoryManager::lastAllocRequestedSlots = 0 |
Definition at line 313 of file qv4mm_p.h.
Referenced by allocData(), allocString(), and runGC().
PersistentValueStorage* QV4::MemoryManager::m_persistentValues |
Definition at line 297 of file qv4mm_p.h.
Referenced by QV4::PersistentValue::PersistentValue(), QV4::PersistentValue::PersistentValue(), QV4::PersistentValue::PersistentValue(), QJSManagedValue::QJSManagedValue(), ~MemoryManager(), QV4::ExecutionEngine::registerNativeModule(), QV4::PersistentValue::set(), QV4::PersistentValue::set(), and QV4::PersistentValue::set().
PersistentValueStorage* QV4::MemoryManager::m_weakValues |
Definition at line 298 of file qv4mm_p.h.
Referenced by ~MemoryManager().
struct { ... } QV4::MemoryManager::statistics |
Referenced by MemoryManager(), dumpStats(), and runGC().
std::size_t QV4::MemoryManager::unmanagedHeapSize = 0 |
Definition at line 303 of file qv4mm_p.h.
Referenced by allocString(), and runGC().
std::size_t QV4::MemoryManager::unmanagedHeapSizeGCLimit |
std::size_t QV4::MemoryManager::usedSlotsAfterLastFullSweep = 0 |
Heap::MapObject* QV4::MemoryManager::weakMaps = nullptr |
Definition at line 300 of file qv4mm_p.h.
Referenced by registerWeakMap().
Heap::SetObject* QV4::MemoryManager::weakSets = nullptr |
Definition at line 301 of file qv4mm_p.h.
Referenced by registerWeakSet().