Large Object Heap and x64

5 views
Skip to first unread message

jason.hill

unread,
Jul 23, 2008, 3:19:23 AM7/23/08
to nhusers
I have been communicating with someone at MS about extremely high
memory usage of our application on x64 compared to x86.

Enabling 32 bit mode on the IIS7 application pool fixes the problem
but obviously imposes a memory limit on your application.

They asked me to check with the NH folks to see if it is possible that
NH is allocating a lot of objects on the Large Object Heap (LOH). This
is the exact response I received:

Again, the issue with the LOH is that its objects are only collected
after a full GC. This is fine for long-lived objects. But short-lived
objects, such as those allocated and released during execution of an
ASPX page, are bad for the LOH. The GC performs well because Gen 0 is
quick to collect, which means that short-lived objects are normally
very easy to collect, and that memory can be used again. If however
you exceed the current LOH threshold of 85000, your object won’t be
collected until after Gen 0, Gen 1, and Gen 2 are collected. A full
collection like this takes a long time and is expensive to do. If you
allocate too many short-lived objects in the LOH, your Gen 0 to Gen 1
to Gen 2 ratio becomes flat (1:1:1), and your performance will be very
bad. Unfortunately there’s no simple solution to this problem, and it
seems the best we can do is alert people to the problem and possibly
increase the threshold on x64 servers. In particular, framework
builders and application service providers should be aware of this
issue. The only solution for them is to chain smaller buffers
together, and avoid exceeding the 85000 limit. And if it’s an object,
not a buffer (byte array), that they’re allocating, they should
consider redesigning that object to work around this LOH issue.

Apparently they are looking at the possibility of increasing the LOH
threshold from 85000.

Anyone able to comment on this and provide feedback that I can pass
back to MS?

Cheers,

Jason

Ayende Rahien

unread,
Jul 23, 2008, 8:29:09 AM7/23/08
to nhu...@googlegroups.com
Jason,
I can't think of any reason that NH will allocate objects that size unless you are loading large BLOB from the DB
Reply all
Reply to author
Forward
0 new messages