Skip to content

Possible memory leak in arm64ddc? #1087

@krackers

Description

@krackers

Before opening the issue, have you...?

  • Searched for existing issues
  • Looked through the wiki
  • Updated MonitorControl to the latest version (if applicable)

Describe the bug

In this file https://github.com/MonitorControl/MonitorControl/blob/main/MonitorControl/Support/Arm64DDC.swift (and possibly the intel version), I don't see any CFRelease/IOObjectRelease calls, despite the fact that the docs say you must release the iterator and any objects as you iterate through them. But I'm not 100% familiar with swift, does it wrap iokit to take care of these things for you?

Also you should consider using CFSTR macro instead of CFStringCreateWithCString for the string constants that are fixed, so that way you avoid any runtime allocation entirely

Note that I have not traced through instruments to see how big of an impact this is

Steps to reproduce

  • Read through code
  • Notice no cfrelease/ioobject release calls

Expected behavior

  • cfrelease/ioobjectrelease calls added as appropriate

Anything else?

No response

Environment Information (please complete the following information)

- macOS Version 12.4
- MacBook Pro (16-inch, 2021
- Apple Silicon: Yes
- Monitor Control versions: Should affect anything that supports m1?

Metadata

Metadata

Assignees

Labels

doneWork on this issue is complete. Will be available on next release

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions