When is memory, allocated by .NET process, released back to Windows

后端 未结 2 2052
心在旅途
心在旅途 2020-12-01 12:34

The Setup

.NET allocates memory for each generation’s heap (0, 1, 2, LOH) in segments to get a continuous block of memory, on startup, and when it a

2条回答
  •  旧巷少年郎
    2020-12-01 12:50

    I don't know the answer to this, but I suspect that .NET doesn't release its heaps until the process exits (and possibly on unloading an AppDomain, at a guess). This is only based on my watching the perfmon .NET Memory counters. The GC total bytes counters shows, at least in my app, that the Reserved bytes go up and down a little over the life of my app, like about 30MB.

    And, if the GC is running in the server mode, perhaps .NET releases memory more often.

提交回复
热议问题