My application allocates a large amount of memory (millions of small objects totaling several gigabytes) and holds onto it for a long time.
Update: Perf counter "% Time in GC" is showing an average of 10.6%.
Use a #pragma warning (C#) or Disable (Visual Basic) directive to suppress the warning for only a specific line of code.
Suppress violations using a global suppression file The global suppression file uses the SuppressMessage attribute. From the Error List, select the rules you want to suppress, and then right-click and select Suppress > in Suppression File.
Suppress specific warnings for Visual C# or F# Or, select the project node and press Alt+Enter. Choose Build, and go to the Errors and warnings subsection. In the Suppress warnings or Suppress specific warnings box, specify the error codes of the warnings that you want to suppress, separated by semicolons.
Unless you can confirm that the garbage collector is actively slowing the performance of your application, you should not take steps to cripple the functionality of your runtime environment.
Judging from your question, you have not confirmed that the GC is a problem. I severely doubt that it is.
Optimize only what needs to be optimized.
You can stop the garbage collector from finalizing any of your objects using the static method:
GC.SuppressFinalize(*your object*)
More information here: link text
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With