Unusual JavaFX8 OutOfMemoryError - FadeTransition

After several hours of trying to track down a memory error in my application, I managed to reduce it to some strange behavior in a very simple JFX program:

Take the following simple example, which gradually fades a rectangle on a transparent canvas:

public class Test extends Application {

    @Override
    public void start(Stage primaryStage) {
        primaryStage.initStyle(StageStyle.TRANSPARENT);
        int width = 1920;
        int height = 1080;

        Rectangle rect = new Rectangle(width, height);
        rect.setFill(Color.SALMON);
        rect.setOpacity(0);
        StackPane scenePane = new StackPane();
        scenePane.getChildren().add(rect);
        primaryStage.setScene(new Scene(scenePane));
        primaryStage.setWidth(width);
        primaryStage.setHeight(height);
        primaryStage.show();
        FadeTransition ft = new FadeTransition(Duration.millis(10000), rect);
        ft.setToValue(1);
        ft.play();
    }

    public static void main(String[] args) {
        launch(args);
    }

}

When starting with VM args, -Xms100m -Xmx100mthis does not cause problems. However, when I provide the VM with essentially more memory (e.g. -Xms1000m -Xmx1000m), it crashes very quickly:

java.lang.OutOfMemoryError
        at sun.misc.Unsafe.allocateMemory(Native Method)
        at java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:127)
        at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:311)
        at com.sun.prism.impl.BufferUtil.newByteBuffer(BufferUtil.java:90)
        at com.sun.prism.impl.BufferUtil.newIntBuffer(BufferUtil.java:121)
        at com.sun.javafx.tk.quantum.UploadingPainter.run(UploadingPainter.java:148)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
        at com.sun.javafx.tk.RenderJob.run(RenderJob.java:58)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:125)
        at java.lang.Thread.run(Thread.java:745)

More than one profiler that I tried shows a bunch, since it hardly takes up any allocated space, but viewing the process in the task manager shows that it scans all the available memory through the rest of the memory.

- , width height (a width of 1921, , , , . )

. , , ( , , .) Java 8 ( 8u20) - Java 7/JFX 2.x. Windows 7x64.

- , - , ? , , , ...

: Windows 8, Windows 7 ( Mac) . , JFX- , , , , , .

+4
1

, OutOfMemeoryError:

stacktrace, JavaFX DirectByteBuffer , , . () , , .

. 32- Java-VM 4 , 2 , 2 java-. -Xms1000m -Xmx1000m , 1 VM-, , Non-heap-memory (, PermGen ..), , GB, .

+5

All Articles