简体   繁体   English

远程方法调用期间发生OutOfMemoryException

[英]OutOfMemoryException during remote method call

Iam getting OutOfMemoryException while making remote method call. 我在进行远程方法调用时获取OutOfMemoryException。

"RemoteEntity.SetLocalStore(DATASET);" “ RemoteEntity.SetLocalStore(DATASET);”

passed value is dataset. 传递的值是数据集。

Note Size of dataset is 38mb 注意数据集的大小是38mb

Envoirment c# VS2008 开发环境C#VS2008

Thanks 谢谢

Code : 代码:

private void backgroundSync_DoWork(object sender, DoWorkEventArgs e)
        {            
            backgroundSync.ReportProgress(10, "Fetching data for sync ...");
            EngagementSet _remoteSet = HKMPClient.Instance.RemoteEntity.GetLocalStore();



            //Update to release memory.
            HKMPClient.Instance.RemoteEntity.SetLocalStore(null);
            //dispose RemoteEntity
            HKMPClient.Instance.DisconnectAndDispose();

            HKMP.EngagementWorks.Windows.BLL.Engagements.Engagement.MergeEntitiesInLimitedConnecitivity(_remoteSet,EngagementID);            
            backgroundSync.ReportProgress(10, "Synchronizing Engagement ...");
            DialogSync _dlgSync = new DialogSync(this.EngagementID, _remoteSet);
            _dlgSync.ServiceRequestStarted += new DialogSync.OnServiceRequestStarted(_dlgSync_ServiceRequestStarted);
            _dlgSync.ServiceRequestCompleted += new DialogSync.OnServiceRequestCompleted(_dlgSync_ServiceRequestCompleted);
            if (_dlgSync.IsShown())
            {
                _dlgSync.StartPosition = FormStartPosition.CenterParent;
                _dlgSync.WindowState = FormWindowState.Normal;
                _dlgSync.ShowDialog();
            }
            //Disposed to release object.
            _dlgSync.Dispose();
            _dlgSync = null;


            // connect again                
            HKMPClient.Instance.Connect(e.Argument.ToString());

            _remoteSet.RemotingFormat = SerializationFormat.Binary;

            HKMPClient.Instance.RemoteEntity.SetLocalStore(_remoteSet);

        }

I think you know the answer, 38mb is WAY too big to do over a remote call. 我想您知道答案,38mb太大了,无法通过远程呼叫进行。 What will help diagnose it further would be to show a complete example by simplfying your problem to just two functions running locally. 可以通过将问题简化为仅在本地运行的两个功能来显示完整的示例,这将有助于进一步诊断它。

This will help detect if it is the size of the dataset or a size constraint in the remote interface / network configuration. 这将有助于检测它是数据集的大小还是远程接口/网络配置中的大小限制。

Additionally having a working sample would allow someone else to replicate the issue and see the type information (for example, we can't see what object type is throwing the exception and can't look up any constraints in MSDN). 此外,拥有一个有效的样本将使其他人可以复制问题并查看类型信息(例如,我们无法看到哪种对象类型引发了异常,并且无法在MSDN中查找任何约束)。 I'm sure with this someone would be able to provide a definitive answer. 我敢肯定,有人可以提供明确的答案。

The act of reducing your code to a sample will in itself probably enable you to find the cause. 将代码简化为样本的行为本身可能使您能够找到原因。

Ryan 瑞安

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM