Swing VolatileImages memory leak while rotating device

My app had a problem rotating the device (auto layout adjustments in progress). The memory deletion is canceled after ca 20 turns.

A similar issue shows up when rotating java jdk jvisualvm. Upon investigation, it turned out that the problem was with the buffered images and their highlighted flying image.

/**
 * Maps from GraphicsConfiguration to VolatileImage.
 */
 private Map<GraphicsConfiguration,VolatileImage> volatileMap = new
                        HashMap<GraphicsConfiguration,VolatileImage>(1);

      

When I change RepaintManager

to use volatileImageBufferEnabled=false

, no problem appears and there is no memory leak.

I read about scaling and transforming images during rotation, is this responsible for this? or is it a bug in java?

Is there a way to avoid leaking memory and using volatile images?

thank

+3


source to share





All Articles