@@ -32,7 +32,7 @@ pub(crate) struct MemoryChunk {
3232 pub ( crate ) allocation_type : AllocationType ,
3333 pub ( crate ) name : Option < String > ,
3434 /// Only used if [`crate::AllocatorDebugSettings::store_stack_traces`] is [`true`]
35- pub ( crate ) backtrace : Arc < Backtrace > ,
35+ pub ( crate ) backtrace : Option < Arc < Backtrace > > ,
3636 next : Option < std:: num:: NonZeroU64 > ,
3737 prev : Option < std:: num:: NonZeroU64 > ,
3838}
@@ -79,7 +79,7 @@ impl FreeListAllocator {
7979 offset : 0 ,
8080 allocation_type : AllocationType :: Free ,
8181 name : None ,
82- backtrace : Arc :: new ( Backtrace :: disabled ( ) ) ,
82+ backtrace : None ,
8383 prev : None ,
8484 next : None ,
8585 } ,
@@ -162,7 +162,7 @@ impl SubAllocator for FreeListAllocator {
162162 allocation_type : AllocationType ,
163163 granularity : u64 ,
164164 name : & str ,
165- backtrace : Arc < Backtrace > ,
165+ backtrace : Option < Arc < Backtrace > > ,
166166 ) -> Result < ( u64 , std:: num:: NonZeroU64 ) > {
167167 let free_size = self . size - self . allocated ;
168168 if size > free_size {
@@ -302,7 +302,7 @@ impl SubAllocator for FreeListAllocator {
302302 } ) ?;
303303 chunk. allocation_type = AllocationType :: Free ;
304304 chunk. name = None ;
305- chunk. backtrace = Arc :: new ( Backtrace :: disabled ( ) ) ;
305+ chunk. backtrace = None ;
306306
307307 self . allocated -= chunk. size ;
308308
@@ -384,7 +384,7 @@ impl SubAllocator for FreeListAllocator {
384384 chunk. offset,
385385 chunk. allocation_type,
386386 name,
387- chunk. backtrace
387+ chunk. backtrace. as_ref ( ) . map_or ( & Backtrace :: disabled ( ) , |b| & b )
388388 ) ;
389389 }
390390 }
0 commit comments