Skip to content

Commit cdb817f

Browse files
committed
removed redundant checks to GC_enable/disable, as the state is ref counted
1 parent 0ca4405 commit cdb817f

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

mono/metadata/unity-memory-info.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -614,9 +614,7 @@ static void CollectMonoImageFromAssembly(MonoAssembly *assembly, void *user_data
614614

615615
MonoManagedMemorySnapshot* mono_unity_capture_memory_snapshot()
616616
{
617-
int wasDisabled = GC_is_disabled();
618-
if (!wasDisabled)
619-
GC_disable();
617+
GC_disable();
620618

621619
if (GC_collection_in_progress() == TRUE)
622620
GC_wait_for_gc_completion();
@@ -641,10 +639,9 @@ MonoManagedMemorySnapshot* mono_unity_capture_memory_snapshot()
641639

642640
g_hash_table_destroy(monoImages);
643641

644-
if (!wasDisabled)
645-
GC_enable();
646-
647642
GC_start_world_external();
643+
GC_enable();
644+
648645
return snapshot;
649646
}
650647

0 commit comments

Comments
 (0)