远程方法调用期间出现 OutOfMemoryException

发布于 2024-08-09 14:54:00 字数 1813 浏览 2 评论 0原文

我在进行远程方法调用时收到 OutOfMemoryException。

“RemoteEntity.SetLocalStore(数据集);”

传递的值是数据集。

注意数据集大小为 38mb

Envoirment c# VS2008

感谢

代码:

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);

        }

Iam getting OutOfMemoryException while making remote method call.

"RemoteEntity.SetLocalStore(DATASET);"

passed value is dataset.

Note Size of dataset is 38mb

Envoirment 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);

        }

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

聊慰 2024-08-16 14:54:00

我想你知道答案,38mb 对于远程调用来说太大了。有助于进一步诊断的方法是通过将问题简化为仅在本地运行的两个函数来显示完整的示例。

这将有助于检测它是否是数据集的大小或远程接口/网络配置中的大小限制。

此外,拥有一个工作示例将允许其他人复制问题并查看类型信息(例如,我们看不到抛出异常的对象类型,也无法在 MSDN 中查找任何约束)。我相信有人能够提供明确的答案。

将代码简化为示例的行为本身可能会让您找到原因。

瑞安

I think you know the answer, 38mb is WAY too big to do over a remote call. 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). 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文