Uploaded image for project: 'Code Tools'
  1. Code Tools
  2. CODETOOLS-7901794

Limit the @State instance counts for large @State objects to dodge OOME

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P2 P2
    • None
    • None
    • tools
    • None

      For example, see the test like this:

      @JCStressTest
      @State
      public class ByteTest {
          volatile byte[] arr;

          @Actor
          public void actor1() {
              arr = new byte[2 * 1024 * 1024];
          }
       ...
      }

      Each instance of this @State would take at least 2 Mb of space. And here is where it gets tricky: the harness itself would try to autobalance the stride size to improve test performance. Among other things, this will affect the size of the @State object array:

        Solo stride size will be autobalanced within [10, 10000] elements

      Which means, with 10K @State objects, 2Mb each, we have to have 20 Gb on heap to store them all. This blows 32-bit address space, if autobalancing trips over the 2K limit. We need to figure the way out for special tests like these.

            shade Aleksey Shipilev
            shade Aleksey Shipilev
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: