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

GraphicsConfigurations for BufferedImages are created too aggressively

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 1.4.0
    • 1.3.1
    • client-libs
    • None
    • 2d
    • beta3
    • generic
    • generic

      The code to construct a Graphics object from a BufferedImage causes a
      GraphicsConfiguration object to be created for the BufferedImage even
      if noone ever calls the getDeviceConfiguration() method on the Graphics
      object.

      The GraphicsConfig object so constructed is cached for future calls to
      getGraphics() and createGraphics(), but as it is rare for a caller to
      actually request this object, its creation is a waste. This extra
      allocation can affect the amount of garbage created in programs which
      create a lot of transient BufferedImage objects.

      Note that the internal support for drawing the Raster objects from
      custom Paint objects implicitly uses lots of BufferedImage objects so
      heavy use of TexturePaint, GradientPaint or other Custom Paint objects
      can tickle lots of these allocations.

            flar Jim Graham
            flar Jim Graham
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: