Derby
  1. Derby
  2. DERBY-5701

Make UpdatableResultSetTest less hungry on heap space

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 10.9.1.0
    • Fix Version/s: 10.9.1.0
    • Component/s: Test
    • Labels:
      None

      Description

      UpdatableResultSetTest fails with an OutOfMemoryError in my environment when I run it with a 50 MB heap. Some of its test cases open close to 900 statements, and they leave many of the statements open till tearDown(). It would be good if the test cases cleaned up the open statements earlier to avoid these peaks in memory usage.

      1. d5701-1a.diff
        4 kB
        Knut Anders Hatlen

        Activity

        Hide
        Knut Anders Hatlen added a comment -

        Committed revision 1329148.

        Show
        Knut Anders Hatlen added a comment - Committed revision 1329148.
        Hide
        Knut Anders Hatlen added a comment -

        Attaching a patch which makes the following changes to the test:

        runTestUpdateXXXAllDataTypesInsertRow() - create a single statement that is re-used across iterations, instead of creating a new statement on each iteration, and close it when done.

        verifyData() - reorganize some if/else-if statements to get rid of return statements that prevent close() from being called, and use BaseJDBCTestCase.closeStatement() to prevent BaseJDBCTestCase.statements from accumulating hundreds of statements.

        resetData() - close the statement when done.

        It was primarily the changes in verifyData() that helped on the heap usage.

        The test finished successfully with 15 MB heap after the patch was applied.

        Show
        Knut Anders Hatlen added a comment - Attaching a patch which makes the following changes to the test: runTestUpdateXXXAllDataTypesInsertRow() - create a single statement that is re-used across iterations, instead of creating a new statement on each iteration, and close it when done. verifyData() - reorganize some if/else-if statements to get rid of return statements that prevent close() from being called, and use BaseJDBCTestCase.closeStatement() to prevent BaseJDBCTestCase.statements from accumulating hundreds of statements. resetData() - close the statement when done. It was primarily the changes in verifyData() that helped on the heap usage. The test finished successfully with 15 MB heap after the patch was applied.

          People

          • Assignee:
            Knut Anders Hatlen
            Reporter:
            Knut Anders Hatlen
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development