GC.AddMemoryPressure in C#
- by ssheldon
I am writing an application in C# that makes use of a 3rd party COM DLL, this dll creates a lot of resources (like bitmaps, video, data structures) in unmanaged memory. While digging around I came across the following call for the Garbage Collector:
GC.AddMemoryPressure(long long bytesAllocated)
It is documented in MSDN here:
http://msdn.microsoft.com/en-us/library/system.gc.addmemorypressure.aspx
This sounds like something I should be calling since this external dll is createing a lot of resources the CLR is unaware of.
I guess I have two questions...
How do I know how much memory pressure to add when the dll is 3rd party and it's not possible for me to know exactly how much memory this dll is allocating.
How important is it to do this?