Pool::~Pool() { if (get_thread_local_memory_pool() == fMemPool.get()) {
SkDEBUGFAIL("SkSL pool is being destroyed while it is still attached to the thread");
set_thread_local_memory_pool(nullptr);
}
void* Pool::AllocMemory(size_t size) { // Is a pool attached?
MemoryPool* memPool = get_thread_local_memory_pool(); if (memPool) { void* ptr = memPool->allocate(size);
SkVLOG("ALLOC Pool:0x%016llX 0x%016llX\n", (uint64_t)memPool, (uint64_t)ptr); return ptr;
}
// There's no pool attached. Allocate memory using the system allocator. void* ptr = ::operatornew(size);
SkVLOG("ALLOC Pool:__________________ 0x%016llX\n", (uint64_t)ptr); return ptr;
}
void Pool::FreeMemory(void* ptr) { // Is a pool attached?
MemoryPool* memPool = get_thread_local_memory_pool(); if (memPool) {
SkVLOG("FREE Pool:0x%016llX 0x%016llX\n", (uint64_t)memPool, (uint64_t)ptr);
memPool->release(ptr); return;
}
// There's no pool attached. Free it using the system allocator.
SkVLOG("FREE Pool:__________________ 0x%016llX\n", (uint64_t)ptr);
::operatordelete(ptr);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.