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

Alexander Zuev kizune at openjdk.org
Mon Mar 3 22:50:56 UTC 2025


On Mon, 3 Mar 2025 18:47:54 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:

> The current patch will not solve any of these issues, as the check in advance may pass while the code still fails producing an unexpected exception in the application.

I am not trying to solve this problem for the reason stated above - i do not think it is a problem that needs to be solved. If we think we have enough memory but (in some corner cases) the processing overhead will eat up more memory than we expected it will take - we will fail with OOME and i'm not trying to mask it and provide some way to handle this situation - because i think it is useless. What i am trying to do - is that if we are sure that we do not have enough memory - do not eat it up causing VM to exhaust all its heap just to prove the obvious point - we can't load this sound bank. That's it - there's nothing more that i'm trying to achieve. We read the MIDI, we parse its timeline, we know how long it will be and we can calculate what amount of memory will be required to render it into a sound bank - if we know we do not have it - issue an exception with a reason. If we think we have enough memory but processing overhead or some background task consumed part of it - we will 
 have OOME - here or in that background memory-eating process - it does not matter, we will fail.

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

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


More information about the client-libs-dev mailing list