Derby
  1. Derby
  2. DERBY-5751

Make TriggerTest 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

      TriggerTest.testBlobInTriggerTable() runs some tests with relatively large (7MB) LOBs. These LOBs are created by allocating 7MB arrays and wrapping them in ByteArrayInputStreams. It would require less memory if it used LoopingAlphabetStreams instead.

      1. d5751-1a.diff
        16 kB
        Knut Anders Hatlen

        Activity

        Hide
        Knut Anders Hatlen added a comment -

        Committed revision 1336527.

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

        Attaching a patch that makes the following changes:

        • Use LoopingAlphabetStream and LoopingAlphabetReader instead of
          ByteArrayInputStream and CharArrayReader so that the input data
          arrays don't need to be materialized in memory.
        • Close statements and result sets earlier to allow gc of old
          test data.
        • Use shared helper methods BaseTestCase.assertEquals(Reader,Reader)
          and BaseTestCase.assertEquals(InputStream,InputStream). These also
          ensure that the readers and streams are closed.
        • Added new helper methods to ByteAlphabet and CharAlphabet to make
          it easier to create alphabets consisting of a single value.

        Without the patch, TriggerTest fails with an OutOfMemoryError when I
        give it 140 MB of heap. With the patch, it completes successfully with
        110 MB of heap.

        Show
        Knut Anders Hatlen added a comment - Attaching a patch that makes the following changes: Use LoopingAlphabetStream and LoopingAlphabetReader instead of ByteArrayInputStream and CharArrayReader so that the input data arrays don't need to be materialized in memory. Close statements and result sets earlier to allow gc of old test data. Use shared helper methods BaseTestCase.assertEquals(Reader,Reader) and BaseTestCase.assertEquals(InputStream,InputStream). These also ensure that the readers and streams are closed. Added new helper methods to ByteAlphabet and CharAlphabet to make it easier to create alphabets consisting of a single value. Without the patch, TriggerTest fails with an OutOfMemoryError when I give it 140 MB of heap. With the patch, it completes successfully with 110 MB of heap.

          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