Reputation: 7528
Does
IntPtr ip = Marshal.AllocHGlobal(size);
implicitly add memory pressure (a la GC.AddMemoryPressure)? True it's allocating unmanaged memory, but it doesn't do it "out of the sight of CLR." I could see an argument for either adding or not adding.
It seems like it could (and perhaps should). But I need to know what it actually does.
Upvotes: 1
Views: 277
Reputation: 23975
As per the source code (or for .NET Core), no it doesn't call GC.AddMemoryPressure
.
Upvotes: 2