Pregunta

Iam conseguir OutOfMemoryException mientras que hace llamada a un método remoto.

"RemoteEntity.SetLocalStore (datos);"

valor pasado es el conjunto de datos.

Nota Tamaño del conjunto de datos es 38MB

envoirment c # VS2008

Gracias

Código:

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

        }
¿Fue útil?

Solución

Creo que sabes la respuesta, 38MB es demasiado grande para hacer más de una llamada remota. Lo que ayudará a diagnosticar más lejos sería mostrar un ejemplo completo por simplfying su problema a sólo dos funciones que se ejecutan localmente.

Esto ayudará a detectar si es el tamaño del conjunto de datos o una restricción de tamaño en la configuración de la interfaz / red remota.

Además tener una muestra de trabajo permitiría a otra persona para replicar el problema y ver la información de tipo (por ejemplo, no podemos ver qué tipo de objeto está lanzando la excepción y no podemos buscar cualquier restricciones en MSDN). Estoy seguro de que con ese alguien sería capaz de dar una respuesta definitiva.

El acto de reducir su código para una muestra será en sí mismo, probablemente le permitirá encontrar la causa.

Ryan

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top