@@ -32,7 +32,7 @@ pub(crate) struct MemoryChunk {
32
32
pub ( crate ) allocation_type : AllocationType ,
33
33
pub ( crate ) name : Option < String > ,
34
34
/// Only used if [`crate::AllocatorDebugSettings::store_stack_traces`] is [`true`]
35
- pub ( crate ) backtrace : Arc < Backtrace > ,
35
+ pub ( crate ) backtrace : Option < Arc < Backtrace > > ,
36
36
next : Option < std:: num:: NonZeroU64 > ,
37
37
prev : Option < std:: num:: NonZeroU64 > ,
38
38
}
@@ -79,7 +79,7 @@ impl FreeListAllocator {
79
79
offset : 0 ,
80
80
allocation_type : AllocationType :: Free ,
81
81
name : None ,
82
- backtrace : Arc :: new ( Backtrace :: disabled ( ) ) ,
82
+ backtrace : None ,
83
83
prev : None ,
84
84
next : None ,
85
85
} ,
@@ -162,7 +162,7 @@ impl SubAllocator for FreeListAllocator {
162
162
allocation_type : AllocationType ,
163
163
granularity : u64 ,
164
164
name : & str ,
165
- backtrace : Arc < Backtrace > ,
165
+ backtrace : Option < Arc < Backtrace > > ,
166
166
) -> Result < ( u64 , std:: num:: NonZeroU64 ) > {
167
167
let free_size = self . size - self . allocated ;
168
168
if size > free_size {
@@ -302,7 +302,7 @@ impl SubAllocator for FreeListAllocator {
302
302
} ) ?;
303
303
chunk. allocation_type = AllocationType :: Free ;
304
304
chunk. name = None ;
305
- chunk. backtrace = Arc :: new ( Backtrace :: disabled ( ) ) ;
305
+ chunk. backtrace = None ;
306
306
307
307
self . allocated -= chunk. size ;
308
308
@@ -384,7 +384,7 @@ impl SubAllocator for FreeListAllocator {
384
384
chunk. offset,
385
385
chunk. allocation_type,
386
386
name,
387
- chunk. backtrace
387
+ chunk. backtrace. as_ref ( ) . map_or ( & Backtrace :: disabled ( ) , |b| & b )
388
388
) ;
389
389
}
390
390
}
0 commit comments