If a 3D Mesh is updated with different Vertices/Indices, Metal pipeline is 
creating a new Vertex/Index MTLBuffer without releasing the old Buffer. Running 
the sample program in JBS reveals that memory footprint increases to ~300MB 
from the initial ~120MB after running for 30 minutes. Releasing the MTLBuffer 
resolves this memory leak issue.

Functional and Performance testing is green with this change. Refer to JBS 
comments for in depth details of testing. We can't reliably measure the 
increase/decrease in memory footprint for this leak, so there is no regression 
test.

I have also cleared the unused multi buffer logic for these Vertex/Index data.

---------
- [x] I confirm that I make this contribution in accordance with the [OpenJDK 
Interim AI Policy](https://openjdk.org/legal/ai).

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

Commit messages:
 - Cleanup unused multi buffer code
 - 8389127: Native memory leak in macOS Metal 3D mesh rendering

Changes: https://git.openjdk.org/jfx/pull/2243/files
  Webrev: https://webrevs.openjdk.org/?repo=jfx&pr=2243&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8389127
  Stats: 41 lines in 4 files changed: 0 ins; 17 del; 24 mod
  Patch: https://git.openjdk.org/jfx/pull/2243.diff
  Fetch: git fetch https://git.openjdk.org/jfx.git pull/2243/head:pull/2243

PR: https://git.openjdk.org/jfx/pull/2243

Reply via email to