リモートメソッド呼び出し中でOutOfMemoryException
-
12-09-2019 - |
質問
Iamは、リモートメソッド呼び出しをしながらのOutOfMemoryExceptionなっています。
"RemoteEntity.SetLocalStore(DATASET);"
渡された値がセットされます。
データセットの注サイズは38メガバイトです。
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);
}
解決
私は38メガバイトは、リモート呼び出しを介して行う方法は大きすぎる、あなたは答えを知っていると思います。さらにローカルで実行しているだけで二つの機能に問題をsimplfyingことにより、完全な例を示すことになり、それを診断何をするのに役立ちます。
これは、リモート・インタフェース/ネットワーク構成でデータセットやサイズの制約の大きさであるかどうかを検出するのに役立ちます。
は、さらに、(例えば、我々は例外を投げているし、MSDNで任意の制約を検索することはできませんどのようなオブジェクトタイプを参照することはできません)ワーキングサンプルが他の誰かが問題を複製し、型情報を見ることができるようになるました。私は、この誰かが決定的な答えを提供することができるだろうと確信しています。
サンプルにあなたのコードを低下させる行為は、それ自体が、おそらく原因を見つけることができます。
ライアン
所属していません StackOverflow