2

I have a WCF Service was uses the HTTP protocol. When a particularly large query hits the system, it creates a large Byte[] that leads up through buffers to HttpChannelListener and eventualy to the Service Host itself. This stays there even after the WCF transaction completes. This in turn causes Large Object Heap fragmentation which eventually causes the application to throw an OOM exception.

Here's the path to the Byte[]: ServiceHost.channelDispatchers.items._items[0].listener.innerChannelListener.typedListener.bufferManager.innerBufferManager.bufferPools[13].pool.globalPool.items._array[0]

The system uses buffered WCF communication for transactions to ensure that it's reliable.

Is there anything I can do to prevent these large objects from staying in memory?

gin drskvy
  • 305
  • 2
  • 11

1 Answers1

1

You need to tune the MaxBufferPoolSize and MaxBufferSize property of your WCF configuration. You may need to do experiment on what is the best value which suits the nature of your application, it depends on your message size, number of concurrent request, etc.

You may also set MaxBufferPoolSize to 0 to disallow pooling of buffer. It still buffered, but the buffer is not pooled. Be sure if this is really what you want because buffer pooling do have it's advantage by reducing memory allocation.

This is some explanation about what those settings actually means, and why it is actually needed.

chenz
  • 730
  • 7
  • 13