We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 2584 - Memory leak in Cocoa_GetDisplayName
Summary: Memory leak in Cocoa_GetDisplayName
Status: RESOLVED WONTFIX
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: HG 2.0
Hardware: x86_64 Mac OS X (All)
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-14 02:07 UTC by Diego
Modified: 2014-07-23 03:53 UTC (History)
0 users

See Also:


Attachments
Leak code (362 bytes, text/plain)
2014-06-19 15:30 UTC, Diego
Details
Leak code CGDisplayIOServicePort workaround (2.11 KB, text/plain)
2014-06-19 15:31 UTC, Diego
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Diego 2014-06-14 02:07:02 UTC
The Xcode Instruments Leak tool reports a leak from IODisplayCreateInfoDictionary in Cocoa_GetDisplayName.
This happened after upgrading to Xcode 5.
Comment 1 Sam Lantinga 2014-06-16 00:18:45 UTC
Nice catch!
I think this is fixed, can you verify?
https://hg.libsdl.org/SDL/rev/49562091afe1
Comment 2 Diego 2014-06-16 01:48:08 UTC
Instruments is still reporting the leak. Is there any more information I can give you?
Comment 3 Sam Lantinga 2014-06-16 19:53:09 UTC
Can you investigate further? I'm not very familiar with the Cocoa and native type bridging, and we're not building in ARC mode. Maybe we need to do both CFRelease and NSDictionary release?
Comment 4 Diego 2014-06-19 15:30:52 UTC
Created attachment 1691 [details]
Leak code
Comment 5 Diego 2014-06-19 15:31:37 UTC
Created attachment 1692 [details]
Leak code CGDisplayIOServicePort workaround
Comment 6 Diego 2014-06-19 15:32:04 UTC
I've tried several times but have not been successful in fixing the leak. I haven't been able find any information on the internet about IODisplayCreateInfoDictionary leaking. I submitted a bug report to Apple. I'll update this post as Apple updates the bug status. 

I'd like to know if other people see this leak. Creating a new Xcode 5 project and replacing the code in main.m with the attached main.m code causes the leak on Instruments Leak tool. 
CGDisplayIOServicePort is deprecated with no replacement. I found a workaround for CGDisplayIOServicePort but that made no difference. main_CGDisplayIOServicePort_workaround.m is the workaround code.
io_object_t's like io_service_t can be released with IOObjectRelease() but that's not the problem either. IODisplayCreateInfoDictionary does not leak if you give it a wrong servicePort. Such as changing servicePort to equal 0.
Comment 7 Sam Lantinga 2014-06-21 18:55:38 UTC
Okay, since this appears to be an Apple bug, I'll leave it for now. Feel free to reopen this, if there's a bug fix from Apple or we missed something.

Thanks!
Comment 8 Diego 2014-07-18 23:46:06 UTC
It does appear to be an Apple bug. I got this message today from my Apple bug report. "Engineering has determined that your bug report is a duplicate of another issue and will be closed." The duplicate bug report is still in an open status. So it sounds like there's nothing we can do until they fix it.
Comment 9 Sam Lantinga 2014-07-23 03:53:52 UTC
Okay, thanks for the update!