Remove redundant mono_gc_collect during domain unload (#33229)
During unload_thread_main, **mono_gc_collect** is called 3 times.
First: https://github.com/mono/mono/blob/
280e9d2423549d86686716f0818bcdbac9702ea1/mono/metadata/gc.c#L455
Second: https://github.com/mono/mono/blob/
b4c506c3045516349d03ce8f3fe9fa5b79a7271c/mono/metadata/appdomain.c#L3305
Third: https://github.com/mono/mono/blob/
b4c506c3045516349d03ce8f3fe9fa5b79a7271c/mono/metadata/appdomain.c#L3324
This PR #ifdefs the Second GC Collect for Boehm as it does not use remsets, and removes the third one completely.
The comment for the second gc_collect existence mentions that:
> We need to make sure that we don't have any remsets pointing into static data...(cont)
> However, Unity uses Boehm so it can be defined out.
There seems to be no good reason for the third GC collect, as it is already called before in mono_domain_finalize, It seems like it doesn't do anything using Visual Studio Profiler to check the heap size before and after the gc_collect. **mono_get_heap_size** also remains the same before and after as well (for the second and third at least).
Co-authored-by: Rares95 <Rares95@users.noreply.github.com>