11use std:: { backtrace:: Backtrace , sync:: Arc } ;
22
3- #[ cfg( feature = "visualizer" ) ]
4- mod visualizer;
5- #[ cfg( feature = "visualizer" ) ]
6- pub use visualizer:: AllocatorVisualizer ;
7-
83use log:: debug;
94use objc2:: { rc:: Retained , runtime:: ProtocolObject } ;
105use objc2_foundation:: NSString ;
@@ -13,8 +8,16 @@ use objc2_metal::{
138 MTLStorageMode , MTLTextureDescriptor ,
149} ;
1510
11+ #[ cfg( feature = "visualizer" ) ]
12+ mod visualizer;
13+ #[ cfg( feature = "visualizer" ) ]
14+ pub use visualizer:: AllocatorVisualizer ;
15+
1616use crate :: {
17- allocator:: { self , AllocatorReport , MemoryBlockReport } ,
17+ allocator:: {
18+ AllocationType , AllocatorReport , DedicatedBlockAllocator , FreeListAllocator ,
19+ MemoryBlockReport , SubAllocator ,
20+ } ,
1821 AllocationError , AllocationSizes , AllocatorDebugSettings , MemoryLocation , Result ,
1922} ;
2023
@@ -175,7 +178,7 @@ pub struct CommittedAllocationStatistics {
175178struct MemoryBlock {
176179 heap : Retained < ProtocolObject < dyn MTLHeap > > ,
177180 size : u64 ,
178- sub_allocator : Box < dyn allocator :: SubAllocator > ,
181+ sub_allocator : Box < dyn SubAllocator > ,
179182}
180183
181184impl MemoryBlock {
@@ -196,10 +199,10 @@ impl MemoryBlock {
196199 "MemoryBlock {memory_location:?}"
197200 ) ) ) ) ;
198201
199- let sub_allocator: Box < dyn allocator :: SubAllocator > = if dedicated {
200- Box :: new ( allocator :: DedicatedBlockAllocator :: new ( size) )
202+ let sub_allocator: Box < dyn SubAllocator > = if dedicated {
203+ Box :: new ( DedicatedBlockAllocator :: new ( size) )
201204 } else {
202- Box :: new ( allocator :: FreeListAllocator :: new ( size) )
205+ Box :: new ( FreeListAllocator :: new ( size) )
203206 } ;
204207
205208 Ok ( Self {
@@ -228,7 +231,7 @@ impl MemoryType {
228231 backtrace : Arc < Backtrace > ,
229232 allocation_sizes : & AllocationSizes ,
230233 ) -> Result < Allocation > {
231- let allocation_type = allocator :: AllocationType :: Linear ;
234+ let allocation_type = AllocationType :: Linear ;
232235
233236 let is_host = self . heap_properties . storageMode ( ) != MTLStorageMode :: Private ;
234237 let memblock_size = allocation_sizes. get_memblock_size ( is_host, self . active_general_blocks ) ;
0 commit comments