Answered by:
OutOfMemoryException during sync

Question
-
I'm trying to sync alot of records (500000).
I'm always getting an OutOfMemoryException: The buffer manager failed to allocate a buffer of 14258126 bytes.
I know that I have alot of records to be sent but 14 MB ?? it can't allocate 14 MB? ... Is there a limit size to the buffer manager?
I'm synching from a Device using WCF service as the middle-tier.
What will cause the OutOfMemoryException?
Friday, August 27, 2010 10:35 PM
Answers
-
you can do away with the empy batches actually. before returning the batch anchor, do a select count if it contains rows. if it returns rows, then simply return the anchor, otherwise, increment the anchor with the batch count. chk this thread: http://social.microsoft.com/Forums/en-US/syncdevdiscussions/thread/08e6f9dd-bc48-4742-9cad-aea0290745b2
there's another good thread around initial sync here: http://social.microsoft.com/Forums/en-US/syncdevdiscussions/thread/a2580bed-e606-4174-a075-2822f1939113
- Proposed as answer by L Zhou [MSFT]Editor Thursday, September 2, 2010 5:30 PM
- Marked as answer by Dong CaoMicrosoft employee Friday, September 3, 2010 12:45 AM
Monday, August 30, 2010 12:56 AM
All replies
-
is it wcf throwing the exception? you might want to check the buffer size or message size in the wcf bindingSaturday, August 28, 2010 1:28 AM
-
I've set to the max on both client and server side.
It's happening on the client.
Saturday, August 28, 2010 1:29 AM -
Do you know the reason behind this exception?
Why is it occurring? Is it because the device doesn't have enough memory to deserialize the xml into dataset?
Saturday, August 28, 2010 3:05 AM -
most likely. you reckon you have enough memory on the client? if you're up for it, you can modify the way the dataset is serialized, not that easy though. chk out here: http://jtabadero.spaces.live.com/blog/cns!BF49A449953D0591!1190.entry
Saturday, August 28, 2010 8:16 AM -
Yeah I did the serialization and same issue ...
Saturday, August 28, 2010 5:09 PM -
you might have to break up your sync group or do batching then...Sunday, August 29, 2010 3:59 PM
-
What do you mean by breaking up your sync? like synching multiple time? like sync one table. then start another sync another table?
The problem is that I have this one table that has like 500 000 records. The initial sync is where it run the outofmemory. I first tried the batching but notice one big issue with the batch is that it sends alot of empty batches!
What I came up with is to push the initial sync on the server side. So the server creates a snapshot and sends the sdf file over to the mobile. What do you think of this approach? Any issue I must take into consideration? I'm saving the snapshot on the server database as binary.
Sunday, August 29, 2010 5:42 PM -
you can do away with the empy batches actually. before returning the batch anchor, do a select count if it contains rows. if it returns rows, then simply return the anchor, otherwise, increment the anchor with the batch count. chk this thread: http://social.microsoft.com/Forums/en-US/syncdevdiscussions/thread/08e6f9dd-bc48-4742-9cad-aea0290745b2
there's another good thread around initial sync here: http://social.microsoft.com/Forums/en-US/syncdevdiscussions/thread/a2580bed-e606-4174-a075-2822f1939113
- Proposed as answer by L Zhou [MSFT]Editor Thursday, September 2, 2010 5:30 PM
- Marked as answer by Dong CaoMicrosoft employee Friday, September 3, 2010 12:45 AM
Monday, August 30, 2010 12:56 AM -
For the initial sync its exactly what i came up with and seem to works fine.
For the batching ... I was thinking of doing something similar but I have row filtering and I'm using sql 2005. So I'll have to come up with something smarter to not return empty batch.
Thanks for the help. If you have any other remarks, suggestion, please feel free to add. Thumb up!
Monday, August 30, 2010 1:01 AM -
I am also looking for the solution.
Did you solve this issue?
Thanks
Tuesday, September 14, 2010 12:29 PM