On Tue, 4 Aug 2026 15:08:50 GMT, Roman Marchenko <[email protected]> wrote:
>> This is the fix for "JDK-8389515: Memory leak in dshowwrapper - decoded >> buffers delivered by CSink are never unmapped" >> >> To prevent leaks, the `CSample` class was refactored with new `SetGstBuffer` >> and `TakeGstBuffer` methods that automatically track and manage the mapping >> state of the underlying `GstBuffer`. The `Allocator` and `Sink` are updated >> to use these new methods, ensuring buffers are always properly unmapped and >> released when their ownership is transferred. >> >> The reproducer (`NativeMemoryLeakReproducer.java`) log with the fix applied: >> >> + d:/work/jdk/jdk25/bin/java.exe @jfx/build/run.args >> NativeMemoryLeakReproducer.java demo.mp4 >> Java: 25 (OpenJDK 64-Bit Server VM) >> JavaFX: 28-internal (runtime 28-internal+0-2026-08-04-080015) >> 451.6 MiB >> 459.3 MiB >> 452.4 MiB >> 463.1 MiB >> 465.6 MiB >> 469.9 MiB >> 474.9 MiB >> 494.9 MiB >> 498.5 MiB >> 496.0 MiB >> 509.4 MiB >> >> >> --------- >> - [x] I confirm that I make this contribution in accordance with the >> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai). > > Roman Marchenko has updated the pull request incrementally with one > additional commit since the last revision: > > fix review comments Yes, this is better. I left one inline comment about another cleanup case that I think is needed. @sashamatveev can confirm. modules/javafx.media/src/main/native/gstreamer/plugins/dshowwrapper/Allocator.cpp line 71: > 69: m_pBuffer = NULL; > 70: if (FAILED(hr)) > 71: return hr; If `SetGstBuffer` fails, I think you need to release the sample and clear `*ppBuffer` to avoid leaking sample buffers, since the caller doesn't in the case of a reported failure. Maybe something like this? if (FAILED(hr)) { pSample->Release(); *ppBuffer = null; return hr; } ------------- PR Review: https://git.openjdk.org/jfx/pull/2234#pullrequestreview-4856539537 PR Review Comment: https://git.openjdk.org/jfx/pull/2234#discussion_r3714190927
