Quantcast
Channel: DevNet Questions
Viewing all articles
Browse latest Browse all 8901

OutOfMemoryException while updating documents in a loop.

$
0
0
I have a file to update a field on COM_SKU by SKUNAME. For each record I get the document with GetDocuments DocumentQuery docs = DocumentHelper.GetDocuments(@CMSProduct.Transmission@) .Path(@/Products/@, PathTypeEnum.Children) .Where(@skuname = '@ + parts[0] + @'@) Then I loop through (should only be one doc) the TreeNodeforeach (TreeNode doc in docs) And I set the value and do an udpate.doc[@oenumbers@] = parts[1].Trim(); doc.Update(); I have tried to Dispose() each object at the end of the loops, but memory runs away. I can do the updates directly in the database, but I was trying to use the preferred way. Without the Update(), the process runs fine.

Viewing all articles
Browse latest Browse all 8901

Trending Articles