@@ -324,15 +324,17 @@ void gc_info(gc_info_t *info) {
324
324
info -> total = MP_STATE_MEM (gc_pool_end ) - MP_STATE_MEM (gc_pool_start );
325
325
info -> used = 0 ;
326
326
info -> free = 0 ;
327
+ info -> max_free = 0 ;
327
328
info -> num_1block = 0 ;
328
329
info -> num_2block = 0 ;
329
330
info -> max_block = 0 ;
330
331
bool finish = false;
331
- for (size_t block = 0 , len = 0 ; !finish ;) {
332
+ for (size_t block = 0 , len = 0 , len_free = 0 ; !finish ;) {
332
333
size_t kind = ATB_GET_KIND (block );
333
334
switch (kind ) {
334
335
case AT_FREE :
335
336
info -> free += 1 ;
337
+ len_free += 1 ;
336
338
len = 0 ;
337
339
break ;
338
340
@@ -367,6 +369,12 @@ void gc_info(gc_info_t *info) {
367
369
if (len > info -> max_block ) {
368
370
info -> max_block = len ;
369
371
}
372
+ if (finish || kind == AT_HEAD ) {
373
+ if (len_free > info -> max_free ) {
374
+ info -> max_free = len_free ;
375
+ }
376
+ len_free = 0 ;
377
+ }
370
378
}
371
379
}
372
380
@@ -726,8 +734,8 @@ void gc_dump_info(void) {
726
734
gc_info (& info );
727
735
mp_printf (& mp_plat_print , "GC: total: %u, used: %u, free: %u\n" ,
728
736
(uint )info .total , (uint )info .used , (uint )info .free );
729
- mp_printf (& mp_plat_print , " No. of 1-blocks: %u, 2-blocks: %u, max blk sz: %u\n" ,
730
- (uint )info .num_1block , (uint )info .num_2block , (uint )info .max_block );
737
+ mp_printf (& mp_plat_print , " No. of 1-blocks: %u, 2-blocks: %u, max blk sz: %u, max free sz: %u \n" ,
738
+ (uint )info .num_1block , (uint )info .num_2block , (uint )info .max_block , ( uint ) info . max_free );
731
739
}
732
740
733
741
void gc_dump_alloc_table (void ) {
0 commit comments