views:

152

answers:

1

Hi,

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

        }
A: 

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

Ryan ONeill
thanks for reply.code block is attached
Buzz