Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-1021

Memory usages on Client grows without limit

    • Type: Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 1.9.2
    • Component/s: None
    • Labels:
      None
    • Environment:
      Windows 7 Professional, 32GB ram, Visual Studio 2012 C#

      While using InsertBatch to insert 100,000 documents of between .5mb and 10mb in size the memory usage grows with out bound, reaching the system size of 32GB and then slowly stops writing to Mongo. When commenting out the specifc mongo code, memory usage stays within 500k for the entire set. the Specific mongos is a sharded cluster but the shards all reside on the same machine.

      When tracing through the Source Code from the Official C# API I was unable to locate any obvious issues. Although, there are several delayed LINQ casts and copying of memory that could lead to "confusion" in the Framework. It could possibly be an issue with LINQ and .NET but if that were the case then removing the LINQ and additional copying would likely resolve the issue as well.

      The Attached code file operates in two threads. The primary thread loads an XML files from the file system (300) of them and for each file changes the date, one for each day of 2014. This then queues the Documents to a Task which spins and calls Mongo InsertBatch every time the queue is larger than 100 items. The document size ranges from 3kb to 10KB on disk, so slightly smaller when converted to BSON.

            Assignee:
            Unassigned Unassigned
            Reporter:
            ennis.lynch@fpl.com Ennis Lynch
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: