Unable to allocate direct buffer memory

John Hendrikx hjohn at xs4all.nl
Sun May 10 20:52:41 UTC 2020


They're related.  32767x1137x4 = 149024316.

It would help to know what your app might be doing.  Although it could 
be a bug in JavaFX, it seems more likely that a canvas/image or cached 
group or something is a bit bigger than reasonable.

I think I've seen such errors in my app before I restricted maximum 
sizes of images which were supplied from uncontrolled sources.

--John

On 07/05/2020 20:51, Ty Young wrote:
>
> On 5/6/20 12:39 PM, Ty Young wrote:
>> After hours of running my JavaFX application I start getting this
>> error spammed in console:
>>
>>
>> java.lang.OutOfMemoryError: Cannot reserve 149024316 bytes of direct
>> buffer memory (allocated: 149066725, limit: 209715200)
>>     at java.base/java.nio.Bits.reserveMemory(Bits.java:178)
>>     at
>> java.base/java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:120)
>>     at java.base/java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:329)
>>     at
>> javafx.graphics/com.sun.prism.impl.BufferUtil.newByteBuffer(BufferUtil.java:90)
>>
>>     at
>> javafx.graphics/com.sun.prism.impl.BufferUtil.newIntBuffer(BufferUtil.java:121)
>>
>>     at
>> javafx.graphics/com.sun.prism.impl.QueuedPixelSource.getUnusedPixels(QueuedPixelSource.java:155)
>>
>>     at
>> javafx.graphics/com.sun.javafx.tk.quantum.UploadingPainter.run(UploadingPainter.java:156)
>>
>>     at
>> java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
>>
>>     at
>> java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
>>
>>     at javafx.graphics/com.sun.javafx.tk.RenderJob.run(RenderJob.java:58)
>>     at
>> java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
>>
>>     at
>> java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
>>
>>     at
>> javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:125)
>>
>>     at java.base/java.lang.Thread.run(Thread.java:832)
>>
>>
>> Ironically every single error is about allocating the exact same
>> amount of bytes.
>
>
> Anything on this? I'm also getting:
>
>
> java.lang.RuntimeException: Requested texture dimensions (32767x1137)
> require dimensions (0x1137) that exceed maximum texture size (16384)
>     at
> javafx.graphics/com.sun.prism.es2.ES2RTTexture.create(ES2RTTexture.java:220)
>
>     at
> javafx.graphics/com.sun.prism.es2.ES2ResourceFactory.createRTTexture(ES2ResourceFactory.java:165)
>
>     at
> javafx.graphics/com.sun.javafx.tk.quantum.UploadingPainter.run(UploadingPainter.java:124)
>
>     at
> java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
>
>     at
> java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
>     at javafx.graphics/com.sun.javafx.tk.RenderJob.run(RenderJob.java:58)
>     at
> java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
>
>     at
> java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
>
>     at
> javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:125)
>
>     at java.base/java.lang.Thread.run(Thread.java:832)
>
>
> spammed alternatively.
>


More information about the openjfx-dev mailing list