static void major_dump_heap (FILE *heap_dump_file) { MSBlockInfo *block; FOREACH_BLOCK (block) { int count = MS_BLOCK_FREE / block->obj_size; int i; int start = -1; fprintf (heap_dump_file, "<section type=\"%s\" size=\"%zu\">\n", "old", (size_t)MS_BLOCK_FREE); for (i = 0; i <= count; ++i) { if ((i < count) && MS_OBJ_ALLOCED (MS_BLOCK_OBJ (block, i), block)) { if (start < 0) start = i; } else { if (start >= 0) { mono_sgen_dump_occupied (MS_BLOCK_OBJ (block, start), MS_BLOCK_OBJ (block, i), block->block); start = -1; } } } fprintf (heap_dump_file, "</section>\n"); } END_FOREACH_BLOCK; }
static void major_dump_heap (FILE *heap_dump_file) { MSBlockInfo *block; int *slots_available = alloca (sizeof (int) * num_block_obj_sizes); int *slots_used = alloca (sizeof (int) * num_block_obj_sizes); int i; for (i = 0; i < num_block_obj_sizes; ++i) slots_available [i] = slots_used [i] = 0; FOREACH_BLOCK (block) { int index = ms_find_block_obj_size_index (block->obj_size); int count = MS_BLOCK_FREE / block->obj_size; slots_available [index] += count; for (i = 0; i < count; ++i) { if (MS_OBJ_ALLOCED (MS_BLOCK_OBJ (block, i), block)) ++slots_used [index]; } } END_FOREACH_BLOCK; fprintf (heap_dump_file, "<occupancies>\n"); for (i = 0; i < num_block_obj_sizes; ++i) { fprintf (heap_dump_file, "<occupancy size=\"%d\" available=\"%d\" used=\"%d\" />\n", block_obj_sizes [i], slots_available [i], slots_used [i]); } fprintf (heap_dump_file, "</occupancies>\n"); FOREACH_BLOCK (block) { int count = MS_BLOCK_FREE / block->obj_size; int i; int start = -1; fprintf (heap_dump_file, "<section type=\"%s\" size=\"%zu\">\n", "old", (size_t)MS_BLOCK_FREE); for (i = 0; i <= count; ++i) { if ((i < count) && MS_OBJ_ALLOCED (MS_BLOCK_OBJ (block, i), block)) { if (start < 0) start = i; } else { if (start >= 0) { mono_sgen_dump_occupied (MS_BLOCK_OBJ (block, start), MS_BLOCK_OBJ (block, i), block->block); start = -1; } } } fprintf (heap_dump_file, "</section>\n"); } END_FOREACH_BLOCK; }