hammerspoon: Memory Leak - hs._asm.axuielement

After reading this, I decided to write leaks CommandPost into Terminal and see what it said. It returned a billion lines - so much so that I couldn’t copy and paste into a GitHub issue. So instead, I restarted CommandPost and tried again and got the below. This is just using the default CommandPost configuration.

To be honest, I don’t really understand what the leaks command does - so I have no idea if this is a bad thing or not?

@cmsj ?

Process:         CommandPost [4900]
Path:            /Users/chrishocking/Github/CommandPost-App/build/CommandPost.app/Contents/MacOS/CommandPost
Load Address:    0x10804e000
Identifier:      org.latenitefilms.CommandPost
Version:         1.0.0-beta.30 (1.0.0-beta.30)
Code Type:       X86-64
Parent Process:  ??? [1]

Date/Time:       2018-05-11 14:45:43.588 +1000
Launch Time:     2018-05-11 14:45:31.786 +1000
OS Version:      Mac OS X 10.13.4 (17E202)
Report Version:  7
Analysis Tool:   /Applications/Xcode.app/Contents/Developer/usr/bin/leaks
Analysis Tool Version:  Xcode 9.3 (9E145)

Physical footprint:         85.6M
Physical footprint (peak):  89.2M
----

leaks Report Version: 3.0
leaks[4919]: Process 4900 is not debuggable.
Due to security restrictions, leaks cannot show memory contents of restricted processes.

Process 4900: 253420 nodes malloced for 29325 KB
Process 4900: 96 leaks for 5376 total leaked bytes.

Leak: 0x60000088ad70  size=80  zone: DefaultMallocZone_0x1083e5000   CFData  ObjC  CoreFoundation
Leak: 0x60000088b540  size=80  zone: DefaultMallocZone_0x1083e5000   CFData  ObjC  CoreFoundation
Leak: 0x60000088b6d0  size=80  zone: DefaultMallocZone_0x1083e5000   CFData  ObjC  CoreFoundation
Leak: 0x60000088b720  size=80  zone: DefaultMallocZone_0x1083e5000   CFData  ObjC  CoreFoundation
Leak: 0x600000c5ad60  size=48  zone: DefaultMallocZone_0x1083e5000   AXUIElement  CFType  HIServices
Leak: 0x600000c5ae80  size=48  zone: DefaultMallocZone_0x1083e5000   AXValue  CFType  HIServices
Leak: 0x600000c5b360  size=48  zone: DefaultMallocZone_0x1083e5000   AXUIElement  CFType  HIServices
Leak: 0x600000c5b420  size=48  zone: DefaultMallocZone_0x1083e5000   AXValue  CFType  HIServices
Leak: 0x600000c5b450  size=48  zone: DefaultMallocZone_0x1083e5000   AXValue  CFType  HIServices
Leak: 0x600000c5ba80  size=48  zone: DefaultMallocZone_0x1083e5000   AXUIElement  CFType  HIServices
Leak: 0x600000c5bab0  size=48  zone: DefaultMallocZone_0x1083e5000   AXValue  CFType  HIServices
Leak: 0x600000c5bae0  size=48  zone: DefaultMallocZone_0x1083e5000   AXValue  CFType  HIServices
Leak: 0x600000c5be10  size=48  zone: DefaultMallocZone_0x1083e5000   AXUIElement  CFType  HIServices
Leak: 0x600000c5be40  size=48  zone: DefaultMallocZone_0x1083e5000   AXValue  CFType  HIServices
Leak: 0x600000c5be70  size=48  zone: DefaultMallocZone_0x1083e5000   AXValue  CFType  HIServices
Leak: 0x60400029d290  size=80  zone: DefaultMallocZone_0x1083e5000   CFData  ObjC  CoreFoundation
Leak: 0x60400029d650  size=80  zone: DefaultMallocZone_0x1083e5000   CFData  ObjC  CoreFoundation
Leak: 0x60400029d740  size=80  zone: DefaultMallocZone_0x1083e5000   CFData  ObjC  CoreFoundation
Leak: 0x60400029d8d0  size=80  zone: DefaultMallocZone_0x1083e5000   CFData  ObjC  CoreFoundation
Leak: 0x60400029da60  size=80  zone: DefaultMallocZone_0x1083e5000   CFData  ObjC  CoreFoundation
Leak: 0x60400029dab0  size=80  zone: DefaultMallocZone_0x1083e5000   CFData  ObjC  CoreFoundation
Leak: 0x60400029dba0  size=80  zone: DefaultMallocZone_0x1083e5000   CFData  ObjC  CoreFoundation
Leak: 0x60400029dc90  size=80  zone: DefaultMallocZone_0x1083e5000   CFData  ObjC  CoreFoundation
Leak: 0x604000449b70  size=48  zone: DefaultMallocZone_0x1083e5000   AXValue  CFType  HIServices
Leak: 0x60400044a0b0  size=48  zone: DefaultMallocZone_0x1083e5000   AXValue  CFType  HIServices
Leak: 0x60400044b1f0  size=48  zone: DefaultMallocZone_0x1083e5000   AXUIElement  CFType  HIServices
Leak: 0x60400044b460  size=48  zone: DefaultMallocZone_0x1083e5000   AXValue  CFType  HIServices
Leak: 0x60400044b490  size=48  zone: DefaultMallocZone_0x1083e5000   AXValue  CFType  HIServices
Leak: 0x60400044ba90  size=48  zone: DefaultMallocZone_0x1083e5000   AXUIElement  CFType  HIServices
Leak: 0x60400044bac0  size=48  zone: DefaultMallocZone_0x1083e5000   AXValue  CFType  HIServices
Leak: 0x60400044baf0  size=48  zone: DefaultMallocZone_0x1083e5000   AXValue  CFType  HIServices
Leak: 0x60400044bc10  size=48  zone: DefaultMallocZone_0x1083e5000   AXUIElement  CFType  HIServices
Leak: 0x60400044bc40  size=48  zone: DefaultMallocZone_0x1083e5000   AXValue  CFType  HIServices
Leak: 0x60400044bc70  size=48  zone: DefaultMallocZone_0x1083e5000   AXValue  CFType  HIServices
Leak: 0x60400044c030  size=48  zone: DefaultMallocZone_0x1083e5000   AXUIElement  CFType  HIServices
Leak: 0x60400044c060  size=48  zone: DefaultMallocZone_0x1083e5000   AXValue  CFType  HIServices
Leak: 0x60400044c090  size=48  zone: DefaultMallocZone_0x1083e5000   AXValue  CFType  HIServices
Leak: 0x60400044c3f0  size=48  zone: DefaultMallocZone_0x1083e5000   AXUIElement  CFType  HIServices
Leak: 0x60400044c420  size=48  zone: DefaultMallocZone_0x1083e5000   AXValue  CFType  HIServices
Leak: 0x60400044c450  size=48  zone: DefaultMallocZone_0x1083e5000   AXValue  CFType  HIServices
Leak: 0x60400044c4b0  size=48  zone: DefaultMallocZone_0x1083e5000   AXValue  CFType  HIServices
Leak: 0x60400044c4e0  size=48  zone: DefaultMallocZone_0x1083e5000   AXUIElement  CFType  HIServices
Leak: 0x60400044c510  size=48  zone: DefaultMallocZone_0x1083e5000   AXValue  CFType  HIServices
Leak: 0x60400044c810  size=48  zone: DefaultMallocZone_0x1083e5000   AXUIElement  CFType  HIServices
Leak: 0x60400044c840  size=48  zone: DefaultMallocZone_0x1083e5000   AXValue  CFType  HIServices
Leak: 0x60400044c870  size=48  zone: DefaultMallocZone_0x1083e5000   AXValue  CFType  HIServices
Leak: 0x60400044ca20  size=48  zone: DefaultMallocZone_0x1083e5000   AXValue  CFType  HIServices
Leak: 0x60400044cab0  size=48  zone: DefaultMallocZone_0x1083e5000   AXValue  CFType  HIServices
Leak: 0x60400044cae0  size=48  zone: DefaultMallocZone_0x1083e5000   AXUIElement  CFType  HIServices
Leak: 0x608000681a90  size=80  zone: DefaultMallocZone_0x1083e5000   CFData  ObjC  CoreFoundation
Leak: 0x608000681fe0  size=80  zone: DefaultMallocZone_0x1083e5000   CFData  ObjC  CoreFoundation
Leak: 0x6080008448f0  size=48  zone: DefaultMallocZone_0x1083e5000   AXValue  CFType  HIServices
Leak: 0x608000845370  size=48  zone: DefaultMallocZone_0x1083e5000   AXValue  CFType  HIServices
Leak: 0x6080008453a0  size=48  zone: DefaultMallocZone_0x1083e5000   AXValue  CFType  HIServices
Leak: 0x6080008453d0  size=48  zone: DefaultMallocZone_0x1083e5000   AXUIElement  CFType  HIServices
Leak: 0x608000848790  size=48  zone: DefaultMallocZone_0x1083e5000   AXUIElement  CFType  HIServices
Leak: 0x6080008487c0  size=48  zone: DefaultMallocZone_0x1083e5000   AXValue  CFType  HIServices
Leak: 0x6080008487f0  size=48  zone: DefaultMallocZone_0x1083e5000   AXValue  CFType  HIServices
Leak: 0x60c000651be0  size=48  zone: DefaultMallocZone_0x1083e5000   AXValue  CFType  HIServices
Leak: 0x60c000651c40  size=48  zone: DefaultMallocZone_0x1083e5000   AXValue  CFType  HIServices
Leak: 0x60c000651fd0  size=48  zone: DefaultMallocZone_0x1083e5000   AXUIElement  CFType  HIServices
Leak: 0x60c0006522d0  size=48  zone: DefaultMallocZone_0x1083e5000   AXUIElement  CFType  HIServices
Leak: 0x60c000652630  size=48  zone: DefaultMallocZone_0x1083e5000   AXUIElement  CFType  HIServices
Leak: 0x60c000652660  size=48  zone: DefaultMallocZone_0x1083e5000   AXValue  CFType  HIServices
Leak: 0x60c000652690  size=48  zone: DefaultMallocZone_0x1083e5000   AXValue  CFType  HIServices
Leak: 0x60c000652810  size=48  zone: DefaultMallocZone_0x1083e5000   AXUIElement  CFType  HIServices
Leak: 0x60c000652840  size=48  zone: DefaultMallocZone_0x1083e5000   AXValue  CFType  HIServices
Leak: 0x60c000652870  size=48  zone: DefaultMallocZone_0x1083e5000   AXValue  CFType  HIServices
Leak: 0x60c000652e10  size=48  zone: DefaultMallocZone_0x1083e5000   AXValue  CFType  HIServices
Leak: 0x60c000653140  size=48  zone: DefaultMallocZone_0x1083e5000   AXUIElement  CFType  HIServices
Leak: 0x60c000653230  size=48  zone: DefaultMallocZone_0x1083e5000   AXValue  CFType  HIServices
Leak: 0x60c000653440  size=48  zone: DefaultMallocZone_0x1083e5000   AXValue  CFType  HIServices
Leak: 0x60c000653590  size=48  zone: DefaultMallocZone_0x1083e5000   AXUIElement  CFType  HIServices
Leak: 0x60c0006535f0  size=48  zone: DefaultMallocZone_0x1083e5000   AXValue  CFType  HIServices
Leak: 0x60c000653ce0  size=48  zone: DefaultMallocZone_0x1083e5000   AXUIElement  CFType  HIServices
Leak: 0x60c000653d10  size=48  zone: DefaultMallocZone_0x1083e5000   AXValue  CFType  HIServices
Leak: 0x60c000653d40  size=48  zone: DefaultMallocZone_0x1083e5000   AXValue  CFType  HIServices
Leak: 0x60c000654490  size=48  zone: DefaultMallocZone_0x1083e5000   AXUIElement  CFType  HIServices
Leak: 0x60c0006544c0  size=48  zone: DefaultMallocZone_0x1083e5000   AXValue  CFType  HIServices
Leak: 0x60c000654820  size=48  zone: DefaultMallocZone_0x1083e5000   AXValue  CFType  HIServices
Leak: 0x60c000654910  size=48  zone: DefaultMallocZone_0x1083e5000   AXUIElement  CFType  HIServices
Leak: 0x60c000654940  size=48  zone: DefaultMallocZone_0x1083e5000   AXValue  CFType  HIServices
Leak: 0x60c000654970  size=48  zone: DefaultMallocZone_0x1083e5000   AXValue  CFType  HIServices
Leak: 0x60c000654a00  size=48  zone: DefaultMallocZone_0x1083e5000   AXUIElement  CFType  HIServices
Leak: 0x60c000654a30  size=48  zone: DefaultMallocZone_0x1083e5000   AXValue  CFType  HIServices
Leak: 0x60c000654a60  size=48  zone: DefaultMallocZone_0x1083e5000   AXValue  CFType  HIServices
Leak: 0x60c000684290  size=80  zone: DefaultMallocZone_0x1083e5000   CFData  ObjC  CoreFoundation
Leak: 0x60c000684420  size=80  zone: DefaultMallocZone_0x1083e5000   CFData  ObjC  CoreFoundation
Leak: 0x60c000684790  size=80  zone: DefaultMallocZone_0x1083e5000   CFData  ObjC  CoreFoundation
Leak: 0x60c000684a10  size=80  zone: DefaultMallocZone_0x1083e5000   CFData  ObjC  CoreFoundation
Leak: 0x60c000684b00  size=80  zone: DefaultMallocZone_0x1083e5000   CFData  ObjC  CoreFoundation
Leak: 0x60c000684b50  size=80  zone: DefaultMallocZone_0x1083e5000   CFData  ObjC  CoreFoundation
Leak: 0x60c000684d30  size=80  zone: DefaultMallocZone_0x1083e5000   CFData  ObjC  CoreFoundation
Leak: 0x60c000685320  size=80  zone: DefaultMallocZone_0x1083e5000   CFData  ObjC  CoreFoundation
Leak: 0x60c0006854b0  size=80  zone: DefaultMallocZone_0x1083e5000   CFData  ObjC  CoreFoundation
Leak: 0x60c000685500  size=80  zone: DefaultMallocZone_0x1083e5000   CFData  ObjC  CoreFoundation

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 31 (31 by maintainers)

Most upvoted comments

From a quick glance, I think uielement_selectedText is leaking - the CopyCreate rule suggests that selectedText is ours to free, but all we do is a __bridge NSString*. I suspect that should be a __bridge_transfer.

I’ll take a closer look at the changes I’ve made and make sure I’ve updated everything to the latest master tonight then.

Looking at the output you provided, though, suggests that the leaks aren’t from userdata retention… I’ll give it some thought and see if I can come up with some more tests to make sure we’re chasing real leaks and not something else introduced through the way we’re creating and managing our objects… that we could have legitimate leaks doesn’t surprise me, that we would have as many as some of your initial tests suggest does a little.