none
Memory usage issues with Sync Framework RRS feed

  • Question

  • Hi everyone!

    I'm using Sync Framework to synchronize data between a SQL CE and a SQL Express database.

    My client database (SQL CE) has about 20MB in size. When I start the synchronization, the process (originally consuming 3.000kb of memory) reaches up to 600.000 kb. When the client database is 50MB or more in size, the process consumes more than 1.500.000kb and I fall into an OutOfMemory exception.

    I tried to synchronize using batches and setting a cache size of 100.000 kb, but the problem continues...

    Below is a snapshot of my test code:

        private void StartSync()
        {
          SqlCeConnection clientConnection = new SqlCeConnection(@"Data Source=C:\SampleDatabase.sdf");
          SqlConnection serverConnection = new SqlConnection(@"Data Source=localhost\SQLEXPRESS; Initial Catalog=SyncDB
                                                              ; Integrated Security=True");
          Console.WriteLine("Starting Sync...");
     
          SqlCeSyncProvider clientProvider = new SqlCeSyncProvider("TestScope", clientConnection);
          SqlSyncProvider serverProvider = new SqlSyncProvider("TestScope", serverConnection);
    
          clientProvider.ApplyChangeFailed += new EventHandler<DbApplyChangeFailedEventArgs>(applyChangesFailed);
     
          SyncOrchestrator orchestrator = new SyncOrchestrator();
          orchestrator.Direction = SyncDirectionOrder.Upload;
          orchestrator.LocalProvider = clientProvider;
          orchestrator.RemoteProvider = serverProvider;
     
          try
          {
            orchestrator.Synchronize();
          }
          catch (Exception err)
          {
            Console.WriteLine(String.Format("Sync failed.\n{0}", err.Message));
          }
     
          Console.WriteLine("Sync Finished!");
        }

    The "TestScope" sync scope involves a single table, with only 3 columns (an integer primary key and two varchar fields). The table has no foreign keys.

    Is there any reason for a memory consumption so out of proportion with the database size?

    Thanks in advance!

    Gustavo


    Thursday, September 20, 2012 2:56 PM

All replies

  • what version of Sync Fx and SQL Ce are you running? are you getting any error in the ApplyChangeFailed event?
    Friday, September 21, 2012 2:19 AM
    Moderator
  • I'm running Sync Fx 2.1 and SQL CE 3.5.

    The ApplyChangeFailed event is never triggered.

    Thanks a lot!

    Friday, September 21, 2012 9:26 PM
  • have you tried applying SQL CE SP2?

    also, can you try enabling Sync Framework Tracing and posting back the trace here?

    Saturday, September 22, 2012 1:54 AM
    Moderator
  • Hi! I'll try that and post the results back here as soon as I got them!

    Thanks!!! =)

    Monday, September 24, 2012 12:11 PM