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

Component.BltBufferStrategy doesn't clean up VolatileImage's on strategy switch

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • tbd
    • 1.4.0
    • client-libs
    • 2d
    • x86
    • windows_98



      Name: jk109818 Date: 07/22/2002


      FULL PRODUCT VERSION :
      java version "1.4.0_01"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0_01-b03)
      Java HotSpot(TM) Client VM (build 1.4.0_01-b03, mixed mode)


      FULL OPERATING SYSTEM VERSION :
      Windows 98 [Version 4.10.2222]

      A DESCRIPTION OF THE PROBLEM :
      When switching Canvas BufferStrategy's from
      a BltBufferStrategy that uses VolatileImage
      to another strategy (that is, another createBufferStrategy
      invocation), the old VolatileImage's aren't flush()'ed.

      Around line 2846 of Component.java, there is code to
      clean up FlipBufferStrategy. There should be something
      similar for BltBufferStrategy. In fact I think there
      should be an addition to the API for BufferStrategy
      for a BufferStrategy.dispose() or flush(). But at least
      there should be something for the non-public
      BltBufferStrategy similar to FlipBufferStrategy's
      destroyBuffers().

      The problem can lead to exhausting hardware accelerated
      memory.

      And it worse than that. The interaction with full screen
      mode can be deadly. I ordinarily use double buffering in my
      application with Canvas.createBufferStrategy(2-buffers,
      false-for-no-acceleration, true-for-accelerated-back-buffer,
      null-for-no-flipping). When I switch into full screen mode
      with another window, I find it necessary to switch off other
      hardware accelerated VolatileImage's or there is streen
      strobing as they fight over the display. Then when I switch
      back out of full screen mode and dispose of that window, the
      Canvas and Frame lock up. On Windows 98 I see a white
      window. On Linux (Red Hat 7.1) I see the frozen image of
      the last image drawn to the non-full screen window before
      full screen mode. In both cases I had to kill the app with
      a control-C in the terminal window.

      I hacked a version of BltBufferStrategy that did a flush()
      on the VolatileImage before switching (into non-double
      buffered mode and then) full screen mode, and things were fine.


      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      Obvious from inspection of source code for Component.BltBufferStrategy:
      VolatileImage's are created, but there's nowhere a flush() to release their
      resources.
      ---------- END SOURCE ----------

      CUSTOMER WORKAROUND :
      Once you use a BltBufferStrategy, don't switch to another
      strategy. Or manage your own VolatileImage's.
      (Review ID: 153360)
      ======================================================================

            serb Sergey Bylokhov
            jkimsunw Jeffrey Kim (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: