Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-1519

DBCursor finalizer should not hold on to the query results

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.13.0, 3.0.0
    • Affects Version/s: None
    • Component/s: Query Operations
    • None

      DBCursor has a field that is populated with an instance of a class with a finalize() method, which is used to close a dangling cursor. But the class is an inner class, and therefore references the DBCursor instance, which in turn references the last query batch. This stresses out the garbage collector, which now has to keep all those objects alive until finalize() is called.

      A better design would be to make the class with the finalizer a static inner class that only references the cursor id and server address.

            Assignee:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Reporter:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: