Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8141501

Problems with BitMap buffer management

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • None
    • hotspot
    • b120
    • generic
    • generic

      BitMap has a trivial copy constructor and assignment operator. As a result, making a copy will just make a new reference to the data buffer.

      This means that all copies of a BitMap share the same data buffer, so modifying one modifies all copies. That seems a surprising result for copying, and might not be what's intended.

      This also causes problems for lifetime management of the data buffer:

      All BitMap constructors specify false for the allocator's free_in_destructor argument. That's fine for a BitMap using resource-based allocation. It also works for a BitMap that was constructed from an externally supplied buffer and didn't have a resizing operation performed. However, it means that other uses of BitMap will leak the buffer.

            stefank Stefan Karlsson
            kbarrett Kim Barrett
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: