On Mon, 3 Mar 2025 17:41:13 GMT, Alexander Zuev <kiz...@openjdk.org> wrote:
>> 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. > > Well, it does contain a valid MIDI sequence that produces 1.9GB sound file - > you can try to render it with any MIDI sequencer and will get the same result > - the uncompressed WAV file generated with Apple GarageBand is about 2.1GB. > That's just how MIDI work. If the data is correct then you do not need to add any additional checks in front, just proceed it as is and catch OOM. similar to [this](https://github.com/openjdk/jdk/commit/af20c6b9c4a3a21c1e2c7f56721e1077e7d8f388#diff-b92a36346bec4c6f7d5e8921bd69b038e0932f116d627bb4f6b514e670e1fccdR1035). ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/23814#discussion_r1977934824