@@ -301,7 +301,7 @@ impl Allocator {
301301 const { assert ! ( !std:: mem:: needs_drop:: <T >( ) , "Cannot allocate Drop type in arena" ) } ;
302302
303303 #[ cfg( all( feature = "track_allocations" , not( feature = "disable_track_allocations" ) ) ) ]
304- self . stats . record_allocation ( ) ;
304+ self . stats . record_allocation :: < T > ( std :: mem :: size_of :: < T > ( ) ) ;
305305
306306 self . bump . alloc ( val)
307307 }
@@ -325,7 +325,7 @@ impl Allocator {
325325 #[ inline( always) ]
326326 pub fn alloc_str < ' alloc > ( & ' alloc self , src : & str ) -> & ' alloc str {
327327 #[ cfg( all( feature = "track_allocations" , not( feature = "disable_track_allocations" ) ) ) ]
328- self . stats . record_allocation ( ) ;
328+ self . stats . record_allocation :: < & str > ( std :: mem :: size_of_val ( src ) ) ;
329329
330330 self . bump . alloc_str ( src)
331331 }
@@ -348,7 +348,7 @@ impl Allocator {
348348 #[ inline( always) ]
349349 pub fn alloc_slice_copy < T : Copy > ( & self , src : & [ T ] ) -> & mut [ T ] {
350350 #[ cfg( all( feature = "track_allocations" , not( feature = "disable_track_allocations" ) ) ) ]
351- self . stats . record_allocation ( ) ;
351+ self . stats . record_allocation :: < & [ T ] > ( std :: mem :: size_of_val ( src ) ) ;
352352
353353 self . bump . alloc_slice_copy ( src)
354354 }
@@ -363,7 +363,7 @@ impl Allocator {
363363 /// Panics if reserving space matching `layout` fails.
364364 pub fn alloc_layout ( & self , layout : Layout ) -> NonNull < u8 > {
365365 #[ cfg( all( feature = "track_allocations" , not( feature = "disable_track_allocations" ) ) ) ]
366- self . stats . record_allocation ( ) ;
366+ self . stats . record_allocation :: < Layout > ( 0 ) ;
367367
368368 self . bump . alloc_layout ( layout)
369369 }
@@ -416,7 +416,7 @@ impl Allocator {
416416 ) ;
417417
418418 #[ cfg( all( feature = "track_allocations" , not( feature = "disable_track_allocations" ) ) ) ]
419- self . stats . record_allocation ( ) ;
419+ self . stats . record_allocation :: < [ & str ; N ] > ( total_len ) ;
420420
421421 // Create actual `&str` in a separate function, to ensure that `alloc_concat_strs_array`
422422 // is inlined, so that compiler has knowledge to remove the overflow checks above.
0 commit comments