Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-431

Memory leak in InsertMany?

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None

      Is it possible that there is a memory leak when InsertMany is used?

      I created a simple program GIST and get the following output in pprof

      Showing nodes accounting for 22425.05kB, 100% of 22425.05kB total
      Showing top 10 nodes out of 23
      flat flat% sum% cum cum%
      16144.01kB 71.99% 71.99% 22425.05kB 100% main.main.func2
      3638.89kB 16.23% 88.22% 3638.89kB 16.23% github.com/mongodb/mongo-go-driver/core/wiremessage.Query.AppendWireMessage
      1536.07kB 6.85% 95.07% 1536.07kB 6.85% github.com/mongodb/mongo-go-driver/bson.newElement
      553.04kB 2.47% 97.53% 553.04kB 2.47% github.com/mongodb/mongo-go-driver/bson.NewDocument
      553.04kB 2.47% 100% 6281.04kB 28.01% github.com/mongodb/mongo-go-driver/mongo.(*Collection).InsertMany
      0 0% 100% 553.04kB 2.47% github.com/mongodb/mongo-go-driver/bson.ElementConstructor.ArrayFromElements
      0 0% 100% 512.02kB 2.28% github.com/mongodb/mongo-go-driver/bson.ElementConstructor.ObjectID
      0 0% 100% 1024.05kB 4.57% github.com/mongodb/mongo-go-driver/bson.ElementConstructor.SubDocument
      0 0% 100% 553.04kB 2.47% github.com/mongodb/mongo-go-driver/bson.NewArray
      0 0% 100% 1024.05kB 4.57% github.com/mongodb/mongo-go-driver/bson.ValueConstructor.Document

       

      When I use the same simple program and add every struct one by one with InsertOne, I cannot see that something is waiting to get garbage collected.

            Assignee:
            kris.brandow@mongodb.com Kristofer Brandow (Inactive)
            Reporter:
            thomas.geulen Thomas Geulen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: