While profiling my app (C#, .NET 4), I noticed a third-party library I am using explicitly calls GC.Collect(). This is very annoying because it sometimes has a dramatic impact on my app performance, as some calls to this library end up in huge loops: time spent in GC.Collect account for more than 80% of the total execution time.
Of course, I reported this behaviour to the library maintainers (the lib is not open-source), but while they are working on a new version I'd like to optimize my app. What can I do?
I tried to configure the GC by setting GCSettings.LatencyMode to GCLatencyMode.LowLatency (only during the execution of the library calls, of course), but to no avail. I'd rather avoid forking my process.
Any ideas?