takeMemoryReport function Assets and loading
Takes a MemoryReport of what the engine's shared caches are holding.
Cheap enough to poll (it walks the cache maps and reads each texture's reflected size), so it is reasonable to surface in a debug overlay.
Implementation
MemoryReport takeMemoryReport() {
final textures = textureCacheFootprint();
return MemoryReport([
MemoryCategory(
name: 'textures',
bytes: textures.bytes,
count: textures.count,
),
// A template's footprint is spread across the geometry, materials, and
// textures it realized, which are not individually measurable from here
// yet, so only the count is reported.
MemoryCategory(
name: 'scene templates',
bytes: null,
count: sceneTemplateCacheCount(),
),
]);
}