Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8323068

Fix memory leaks in 3D metal code

XMLWordPrintable

    • generic
    • os_x

      I used leaks cmd utility in macOS to check for memory leaks in 3D rendering.
      I ran RenderPerfTest and ran leaks utility for RenderPerfTest and i see that we have large memory leaks.

      Process: java [9172]
      Path: /Users/USER/*/java
      Load Address: 0x102234000
      Identifier: java
      Version: 18.0.2.1 (0)
      Code Type: ARM64
      Platform: macOS
      Parent Process: zsh [2167]

      Date/Time: 2024-01-04 17:27:53.679 +0530
      Launch Time: 2024-01-04 17:27:43.190 +0530
      OS Version: macOS 13.6.2 (22G320)
      Report Version: 7
      Analysis Tool: /usr/bin/leaks

      Physical footprint: 918.8M
      Physical footprint (peak): 918.8M
      Idle exit: untracked
      ----

      leaks Report Version: 4.0, multi-line stacks
      Process 9172: 6645594 nodes malloced for 457242 KB
      Process 9172: 6519181 leaks for 417985408 total leaked bytes.

      STACK OF 2151822 INSTANCES OF 'ROOT LEAK: <MetalLight>':
      5 ??? 0x11383c010 0x7fffffffffffffff + 9223372041477144593
      4 ??? 0x10bc858ac 0x7fffffffffffffff + 9223372041347422381
      3 libprism_mtl.dylib 0x102382b98 Java_com_sun_prism_mtl_MTLContext_nSetLight + 288
      2 libprism_mtl.dylib 0x102383ab0 -[MetalMeshView setLight:x:y:z:r:g:b:w:ca:la:qa:isA:range:dirX:dirY:dirZ:inA:outA:falloff:] + 188
      1 libobjc.A.dylib 0x1a7ed62a8 _objc_rootAllocWithZone + 40
      0 libsystem_malloc.dylib 0x1a80acf38 _malloc_zone_calloc_instrumented_or_legacy + 228
      ====
          2151822 (164M) << TOTAL >>
            1 (80 bytes) ROOT LEAK: <MetalLight 0x6000018000a0> [80]
            1 (80 bytes) ROOT LEAK: <MetalLight 0x6000018000f0> [80]
            1 (80 bytes) ROOT LEAK: <MetalLight 0x600001800190> [80]
            1 (80 bytes) ROOT LEAK: <MetalLight 0x6000018001e0> [80]
            1 (80 bytes) ROOT LEAK: <MetalLight 0x600001800280> [80]
            1 (80 bytes) ROOT LEAK: <MetalLight 0x6000018002d0> [80]
            1 (80 bytes) ROOT LEAK: <MetalLight 0x600001800370> [80]
            1 (80 bytes) ROOT LEAK: <MetalLight 0x6000018003c0> [80]
            1 (80 bytes) ROOT LEAK: <MetalLight 0x600001800460> [80]
            1 (80 bytes) ROOT LEAK: <MetalLight 0x6000018004b0> [80]
            1 (80 bytes) ROOT LEAK: <MetalLight 0x6000018005a0> [80]
            1 (80 bytes) ROOT LEAK: <MetalLight 0x6000018005f0> [80]



      leaks Report Version: 4.0, multi-line stacks
      Process 9805: 2827044 nodes malloced for 181750 KB
      Process 9805: 2704156 leaks for 130472000 total leaked bytes.

      STACK OF 878478 INSTANCES OF 'ROOT LEAK: <MTLDepthStencilDescriptorInternal>':
      8 ??? 0x115b0fdb4 0x7fffffffffffffff + 9223372041513663925
      7 ??? 0x115aae0c8 0x7fffffffffffffff + 9223372041513263305
      6 libprism_mtl.dylib 0x1047068a0 Java_com_sun_prism_mtl_MTLContext_nRenderMeshView + 48
      5 libprism_mtl.dylib 0x1047080c0 -[MetalMeshView render] + 1452
      4 libprism_mtl.dylib 0x1047091a8 -[MetalPipelineManager getDepthStencilState] + 32
      3 libobjc.A.dylib 0x1a7efcad8 objc_opt_new + 112
      2 com.apple.Metal 0x1b16daf68 +[MTLDepthStencilDescriptor allocWithZone:] + 80
      1 libobjc.A.dylib 0x1a7ed62a8 _objc_rootAllocWithZone + 40
      0 libsystem_malloc.dylib 0x1a80acf38 _malloc_zone_calloc_instrumented_or_legacy + 228
      ====
          2634467 (121M) << TOTAL >>
            ----
            3 (144 bytes) ROOT LEAK: <MTLDepthStencilDescriptorInternal 0x600002c05da0> [48]
               1 (48 bytes) _private + 8 --> <MTLStencilDescriptorInternal 0x600003170000> [48]
               1 (48 bytes) _private --> <MTLStencilDescriptorInternal 0x600002c05d70> [48]
            ----
            3 (144 bytes) ROOT LEAK: <MTLDepthStencilDescriptorInternal 0x600002c2dc80> [48]
               1 (48 bytes) _private + 8 --> <MTLStencilDescriptorInternal 0x600002c60060> [48]
               1 (48 bytes) _private --> <MTLStencilDescriptorInternal 0x600002c312c0> [48]

            jdv Jayathirth D V
            jdv Jayathirth D V
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: