I'm interested if we can specifically call full GC or level 1 GC ?
Asked
Active
Viewed 52 times
0
-
Why would you want to do that? – Yuval Itzchakov Sep 02 '16 at 08:24
-
I'm just curious of possibilities. – Davit Karapetyan Sep 03 '16 at 11:37
2 Answers
0
You may try GC.Collect()
and then GC.WaitForPendingFinalizers()
; else i don't think it's possible..

Essigwurst
- 555
- 10
- 24
-
Can You please explain why should I call WaitForPendingFinalizers() ? – Davit Karapetyan Sep 03 '16 at 13:51
0
You can specify the generation when calling Collect
method
GC.Collect(1);
As Essigwurst wrote - remember about calling GC.WaitForPendingFinalizers()
afterwards.
Bare in mind that explicitly collecting is not reccomended because of permormance issues. You can get more information in these threads:

Community
- 1
- 1

wmioduszewski
- 146
- 2
- 10
-
I should be smarter and check it myself ) Thanks, that is exactly what I wanted. – Davit Karapetyan Sep 03 '16 at 11:39