34GrMemoryPool::GrMemoryPool(
size_t preallocSize,
size_t minAllocSize)
39 fDebug->fAllocationCount = 0;
45 SkASSERT(0 == fDebug->fAllocationCount);
53 int n = fDebug->fAllocatedIDs.count();
54 for (
int id : fDebug->fAllocatedIDs) {
56 SkDebugf(
"Leaked %d IDs (in no particular order): %d%s", n,
id, (n ==
i) ?
"\n" :
"");
58 SkDebugf(
", %d%s",
id, (n ==
i ?
"\n" :
""));
75 header->fStart = alloc.fStart;
79 alloc.fBlock->setMetadata(alloc.fBlock->metadata() + 1);
81#if defined(SK_SANITIZE_ADDRESS)
83#elif defined(SK_DEBUG)
84 header->fSentinel = SkBlockAllocator::kAssignedMarker;
89 static std::atomic<int> nextID{1};
90 return nextID.fetch_add(1, std::memory_order_relaxed);
94 fDebug->fAllocatedIDs.add(
header->fID);
95 fDebug->fAllocationCount++;
99 return alloc.fBlock->ptr(alloc.fAlignedOffset);
105#if defined(SK_SANITIZE_ADDRESS)
107#elif defined(SK_DEBUG)
109 header->fSentinel = SkBlockAllocator::kFreedMarker;
113 fDebug->fAllocatedIDs.remove(
header->fID);
114 fDebug->fAllocationCount--;
121 intptr_t alignedOffset = (intptr_t)
p - (intptr_t)block;
125 memset(
p, 0xDD,
header->fEnd - alignedOffset);
140void GrMemoryPool::validate()
const {
141 fAllocator.validate();
144 for (
const auto*
b : fAllocator.
blocks()) {
145 allocCount +=
b->metadata();
147 SkASSERT(allocCount == fDebug->fAllocationCount);
148 SkASSERT(fDebug->fAllocationCount == fDebug->fAllocatedIDs.count());
static void sk_asan_poison_memory_region(void const volatile *addr, size_t size)
static void sk_asan_unpoison_memory_region(void const volatile *addr, size_t size)
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
static constexpr const T & SkTPin(const T &x, const T &lo, const T &hi)
SkDEBUGCODE(SK_SPI) SkThreadID SkGetThreadID()
void * allocate(size_t size)
static constexpr size_t kAlignment
static std::unique_ptr< GrMemoryPool > Make(size_t preallocSize, size_t minAllocSize)
static constexpr size_t kMinAllocationSize
size_t preallocSize() const
bool release(int start, int end)
void setMetadata(int value)
void releaseBlock(Block *block)
ByteRange allocate(size_t size)
static constexpr int kMaxAllocationSize
BlockIter< true, false > blocks()
Block * owningBlock(const void *ptr, int start)
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
static const char header[]