RFR: 8350813: Rendering of bulky sound bank from MIDI sequence can cause OutOfMemoryError

Sergey Bylokhov serb at openjdk.org
Mon Mar 3 17:07:56 UTC 2025


On Wed, 26 Feb 2025 22:26:48 GMT, Alexander Zuev <kizune at openjdk.org> wrote:

> - Check that the calculated audio data size does not exceed available heap memory before committing to the rendering
> - Add a test case

src/java.desktop/share/classes/com/sun/media/sound/AudioFileSoundbankReader.java line 93:

> 91:             }
> 92: 
> 93:             long maximumHeapSize = Runtime.getRuntime().maxMemory() -

The test program does not contain any "real" large data, so it should not run into an OutOfMemoryError from the start.

Note that after the current patch, the code may still allocate a huge chunk of memory on large systems just by processing a small soundbank which is not good.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/23814#discussion_r1977872436


More information about the client-libs-dev mailing list