GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Possible memory leak in arm64ddc? · Issue #1087 · MonitorControl/MonitorControl

Possible memory leak in arm64ddc? #1087

New issue
Copy link
New issue
Copy link
Closed
Closed
Possible memory leak in arm64ddc?#1087
Copy link
Assignees
krackers
Labels
doneWork on this issue is complete. Will be available on next releaseWork on this issue is complete. Will be available on next release

Description

@krackers
krackers
opened on Jun 16, 2022
Issue body actions

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?

Activity

  1. waydabber commented on Jun 16, 2022

    @waydabber
    waydabber
    on Jun 16, 2022
    Member
    More actions

    HI @krackers - yes, all objects returned by IOKitLib should be released with this function when access to them is no longer needed.. I did not see any practical downside of skipping this in Arm64DDC even while running the app for prolonged time (the effect seems to be minimal), but still, it is proper to call IOObjectRelease on the iterators as advised. I don't think there is any special swift related mechanism is in place to do this with IOKit objects, so it's just an omission on my part (sorry about that). Thanks for pointing it out!

    IntelDDC does this better, but that is thanks to @reitermarkus, not me, I just took most of his code and repurposed it for MonitorControl.

    Please, feel free to contribute to the code or fix/improve whatever you feel must be improved! :)

  2. waydabber
    added
    Type: Enhancement
    on Jun 16, 2022
  3. waydabber
    assigned
    krackers
    on Jun 16, 2022
  4. waydabber
    added a commit that references this issue on Sep 18, 2022

    Implement #1087 (Possible memory leak in arm64ddc?)

    389d587
  5. waydabber commented on Sep 18, 2022

    @waydabber
    waydabber
    on Sep 18, 2022
    Member
    More actions

    Made the proposed changes: #1181

  6. waydabber
    added
    doneWork on this issue is complete. Will be available on next releaseWork on this issue is complete. Will be available on next release
    on Sep 18, 2022
  7. waydabber
    closed this as completedon Sep 18, 2022
  8. waydabber
    added a commit that references this issue on Sep 18, 2022

    Fixed "Possible memory leak in Arm64ddc? #1087"

    d0c4bbf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @krackers
    krackers

Labels

doneWork on this issue is complete. Will be available on next releaseWork 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

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.