Optimize empty CopyOnWriteArrayList allocations

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Fixed
    • Priority: P4
    • 24
    • Affects Version/s: 17, 21, 22, 23
    • Component/s: core-libs
    • None

      We have seen the cases in production where lots of empty CopyOnWriteArrayList-s take a considerable amount of memory/instances. We can follow the example how other collections handled these cases, and initialize with a shared empty array instance.

      See e.g. JDK-8035584 for ArrayList: https://github.com/openjdk/jdk/commit/e0c3c7a07de23cca0ee938eb64af973d567fcdaf

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

              Created:
              Updated:
              Resolved: