File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -328,6 +328,7 @@ impl BufferAllocator {
328328 }
329329 }
330330
331+ const RETAINED_BUFFERS_COUNT : u32 = 2 ;
331332 pub fn cleanup_unused ( & self ) {
332333 let mut guard = self . buffers . lock ( ) . unwrap ( ) ;
333334 for ( buffer_key, buffers) in guard. iter_mut ( ) {
@@ -338,15 +339,8 @@ impl BufferAllocator {
338339 return true ;
339340 }
340341 retained_empty += 1 ;
341- retained_empty < 2
342+ retained_empty < Self :: RETAINED_BUFFERS_COUNT
342343 } ) ;
343- if buffers. len ( ) != buffer_count_before {
344- trace ! (
345- "Freed {} buffers in buffer type {:?}" ,
346- buffer_count_before - buffers. len( ) ,
347- buffer_key
348- ) ;
349- }
350344 }
351345 }
352346}
Original file line number Diff line number Diff line change @@ -229,6 +229,8 @@ impl MemoryAllocator {
229229 self . is_uma
230230 }
231231
232+ const RETAINED_CHUNK_COUNT : u32 = 2 ;
233+
232234 pub fn cleanup_unused ( & self ) {
233235 let mut guard = self . inner . lock ( ) . unwrap ( ) ;
234236 for ( memory_type, chunks) in guard. chunks . iter_mut ( ) {
@@ -239,15 +241,8 @@ impl MemoryAllocator {
239241 return true ;
240242 }
241243 retained_empty += 1 ;
242- retained_empty < 2
244+ retained_empty < Self :: RETAINED_CHUNK_COUNT
243245 } ) ;
244- if chunks. len ( ) != chunks_count_before {
245- trace ! (
246- "Freed {} memory chunks in memory_type {}" ,
247- chunks_count_before - chunks. len( ) ,
248- memory_type
249- ) ;
250- }
251246 }
252247 }
253248}
You can’t perform that action at this time.
0 commit comments