Click here to Skip to main content
15,892,161 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,
I am getting the "Failed to allocate a managed memory buffer of 134217728 bytes" exception when writing a message into a buffered byte array. I have googled all the possible solution and tried them all.

I have maxBufferPoolSize = 2147483647, maxBufferSize = 2147483647, transferMode = "Streamed", have plenty amount of available RAM and disc size. Below is the binding information -

 <binding name="PDIStdCustomBinding" openTimeout="00:02:00" sendTimeout="00:20:00" receiveTimeout="00:20:00" closeTimeout="00:20:00" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647">

<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />

<httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" keepAliveEnabled="true" bypassProxyOnLocal="true"
              transferMode="Streamed" />


I have also tried recycling application pool but none of them help me.

Below is the code block which breaks -

byte[] outputBuffer = bufferManager.TakeBuffer(totalRead + buffer.Offset);


totalReads are 144305981 and offeset is 0.

Can anyone help me to find the solution for this issue.

Thanks.

What I have tried:

Checking the maxBufferPoolSize, maxBufferSize, readerQuotas and MaxBytesPerRead which are 2GB.

transferMode should be Streamed and it is Streamed.

Clearing the garbage collector.

Recycling the application pool manually and increase its virtual and private memory usage to 2GB.
Posted
Updated 14-Jun-16 3:33am
v2
Comments
Patrice T 14-Jun-16 14:49pm    
What kind of message needs such a buffer ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900