Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Is there a way to configure the maxiumum heap size for the CLR?

13 views
Skip to first unread message

Justin

unread,
Aug 20, 2009, 8:23:01 PM8/20/09
to
Is there an equivalent to Java's -mx to set the max heap size with the CLR?
I've search all over in an attempt to find an answer to this, but I have not
been able to. To explain why I want this, I've given a long and detailed
explanation below (for those willing to wade through it).


I have a large ASP.NET application that's deployed across a large cluster.
Once the application is started, as you would expect, the memory usage (as
measured by Private Bytes and Virtual Bytes) grows over a day or so, then
settles down to a relatively constant pattern. Private Bytes goes up and
down (presumably as heap space is committed then released during GC) while
Virtual Bytes remains relatively constant. All good so far.

But what we are finding is that, over time, the pattern for Private Bytes
stays pretty even and it's peak doesn't exceed. However, the Virutal Bytes
does continue to grow slowly. Eventually, we see OutOfMemory errors and
process crash when Virtual Bytes hits around 1.5 GB. We do not see high time
in Garbage Collection, so I believe that this is because of an inability to
reserve Virtual Address Space (or maybe contiguous Virtual Address Space).
Several articles indicate that we should expect Virtual Bytes to be no more
than 600 MB higher than Private Bytes. In our case, we see this difference
grow to over 1 GB, which is around where everything fails.

Now, I believe we have a problem with fragmentation of the Virtual Address
Space, possibly caused by excessive use of large objects and hence the Large
Object Heap (which does not get compacted). We're trying to figure out that
problem, but for now, we just want to avoid crashing.

Along these lines, we tried enabling /3GB to open up a larger Virtual
Address Space. But what I'm finding is that the CLR seems to realize this
and I now see the Private Bytes for my processes levelling out at a higher
point (~ 1.5 GB rather than 800 MB). This difference is visible with the
same workload, so the CLR must be altering the point at which it feels that
Garbage Collection is necessary).

Overall, this seems to make sense. However, I would rather have /3GB expand
my Virtual Address Space, but have the CLR try to keep the manage heap at the
same size (i.e. behave as if /3GB is not enabled). This would allow Private
Bytes to stay where it is without /3GB (which is perfectly sufficient) but
give more room for Virtual Bytes to grow, either giving us longer until it
dies, or hopefully allowing it the room to level out and reach a steady state.

When looking around, I can find no way to tune this "target". This would be
the equivalent of -mx in java (maximum heap size). I found memoryLimit
configuration parameter in machine.config, but this will apparently just set
the threshold at which the worker process will recycle. We use in memory
state management so recycling is not acceptible (another longer term thing to
fix related to that).

So this finally brings me to the question posed at the top. Any help will
be greatly appreciated. And you're a big hearted person if you actually made
it to the end of this ... :-)

0 new messages