未能分配的134217728个字节的托管内存缓冲区。可用存储器的量可以低 [英] Failed to allocate a managed memory buffer of 134217728 bytes. The amount of available memory may be low

查看:2399
本文介绍了未能分配的134217728个字节的托管内存缓冲区。可用存储器的量可以低的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过WCF服务调用保存庞大的数据资料库。我不能调用服务。它抛出一个错误。

  codeProxy.Save codeS(requestHeader,codeS,原codeS);
 

  

未能分配的134217728个字节的托管内存缓冲区。该   可用内存量可能不足

我已经configued在服务器和客户端,以最大限制的网络配置。

客户端的web.config

 <绑定名称=WSHttpBinding_dataServicecloseTimeout =○时01分00秒openTimeout =○时01分00秒receiveTimeout =0点10分〇〇秒的SendTimeout = 0时十分00秒bypassProxyOnLocal =假transactionFlow =假hostNameComparisonMode =StrongWildcardmaxBufferPoolSize =2147483647maxReceivedMessageSize =2147483647messageEncoding =文本textEncoding =UTF-8useDefaultWebProxy =真allowCookies = 假>
                    < readerQuotas MAXDEPTH =32maxStringContentLength =2147483647maxArrayLength =2147483647maxBytesPerRead =2147483647maxNameTableCharCount =2147483647/>
                    <有序的ReliableSession =真正的inactivityTimeout =〇时10分00秒启用=FALSE/>
                    <安全模式=无>
                        <交通运输clientCredentialType =窗口proxyCredentialType =无的境界=/>
                        <消息clientCredentialType =窗口negotiateServiceCredential =真正的algorithmSuite =默认establishSecurityContext =真/>
                    < /安全>
                < /装订>
 

服务器的web.config

 <服务名称=ser.WSHttpBinding_dataServicebehaviorConfiguration =ServiceBehavior>
      <终点合同=ser.IDataservice绑定=的wsHttpBindingbindingConfiguration =数据$ C $内部CService/>
      < /服务>

<的wsHttpBinding>
        <绑定名称=数据$ C $内部CServicehostNameComparisonMode =StrongWildcardmaxBufferPoolSize =2147483647maxReceivedMessageSize =2147483647messageEncoding =文本textEncoding =UTF-8useDefaultWebProxy =真正的allowCookies =假&GT ;
          < readerQuotas MAXDEPTH =32maxStringContentLength =2147483647maxArrayLength =2147483647maxBytesPerRead =2147483647maxNameTableCharCount =2147483647/>
          <有序的ReliableSession =真正的inactivityTimeout =00:10:00启用=FALSE/>
          <安全模式=无>
            <! - <消息clientCredentialType =证书/>  - >
          < /安全>
        < /装订>


< serviceBehaviors>
        <行为NAME =ServiceBehavior>
          < serviceDebug includeExceptionDetailInFaults =真/>
          < serviceMetadata httpGetEnabled =真/>
          < serviceThrottling maxConcurrentSessions =100/>
          < D​​ataContractSerializer的maxItemsInObjectGraph =2147483646/>

        < /行为>
      < / serviceBehaviors>
 

解决方案

如果您遇到此问题上的.Net 2.0服务此修补程序可以帮助

http://support.microsoft.com/kb/974065

  

问题

     

当您正在运行的.NET Framework 2.0的应用程序时,   应用程序崩溃。如果您调试应用程序,您会发现一个   System.InsufficientMemoryException异常。然后你   收到类似于以下错误消息:无法   分配字节的托管内存缓冲区。可用的量   内存可能不足。

     

原因

     

第1期的原因

     

出现此问题的间歇性,当应用程序试图   在一个大对象堆(LOH)的大型对象分配内存。该   错误信息被触发当满足下列条件为真:   堆不能提供足够的存储器来满足蕙分配   请求。一个并发垃圾回收过程中同   时间。问题2的原因

     

出现此问题的原因垃圾回收堆平衡为小   对象分配不具有的计算机上进行努力   超过8个逻辑处理器。正因为如此,更垃圾   集合触发堆保持平衡时,有一个   不平衡的工作量不同的处理器。因此,该   应用程序花费在垃圾收集更多的时间。

I am trying to save a huge data to database through a WCF service call. I am not able to invoke the service. Its throwing a error.

codeProxy.SaveCodes(requestHeader, codes, Rawcodes);

Failed to allocate a managed memory buffer of 134217728 bytes. The amount of available memory may be low

I have configued the web config on server and client side to max limits.

client web.config

<binding name="WSHttpBinding_dataService" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
                    <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
                    <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false"/>
                    <security mode="None">
                        <transport clientCredentialType="Windows" proxyCredentialType="None" realm=""/>
                        <message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default" establishSecurityContext="true"/>
                    </security>
                </binding>

server web.config

<service name="ser.WSHttpBinding_dataService" behaviorConfiguration="ServiceBehavior">
      <endpoint contract="ser.IDataservice" binding="wsHttpBinding" bindingConfiguration="datacodeservice" />
      </service>

<wsHttpBinding>
        <binding name="datacodeservice" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
          <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
          <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false"/>
          <security mode ="None">
            <!--<message clientCredentialType="Certificate" />-->
          </security>
        </binding>


<serviceBehaviors>
        <behavior name="ServiceBehavior">
          <serviceDebug includeExceptionDetailInFaults="true" />
          <serviceMetadata httpGetEnabled="true" />
          <serviceThrottling maxConcurrentSessions="100" />
          <dataContractSerializer maxItemsInObjectGraph="2147483646"/>

        </behavior>
      </serviceBehaviors>

解决方案

If you encounter this issue on a .Net 2.0 service this hotfix may help

http://support.microsoft.com/kb/974065

Issue

When you are running a .NET Framework 2.0-based application, the application crashes. If you debug the application, you notice that a System.InsufficientMemoryException exception is thrown. Then, you receive an error message that resembles the following: Failed to allocate a managed memory buffer of bytes. The amount of available memory may be low.

CAUSE

Cause of Issue 1

This issue occurs intermittently when the application tries to allocate memory for a large object in a large object heap (LOH). The error message is triggered when the following conditions are true: The heap cannot provide sufficient memory to satisfy the LOH allocation request. A concurrent garbage collection is in progress at the same time. Cause of Issue 2

This issue occurs because garbage collector heap balancing for small object allocations is not performed diligently on computers that have more than 8 logical processors. Because of this, more garbage collections are triggered to maintain heap balancing when there is an unbalanced workload in different processors. Therefore, the application spends more time on garbage collection.

这篇关于未能分配的134217728个字节的托管内存缓冲区。可用存储器的量可以低的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆