Skip to content

[src] Fix numerous memory leaks.#24723

Merged
rolfbjarne merged 1 commit intomainfrom
dev/rolf/src-mem-leaks
Feb 18, 2026
Merged

[src] Fix numerous memory leaks.#24723
rolfbjarne merged 1 commit intomainfrom
dev/rolf/src-mem-leaks

Conversation

@rolfbjarne
Copy link
Copy Markdown
Member

No description provided.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request fixes numerous memory leaks in the codebase by properly releasing CoreFoundation array handles returned by "Copy" functions. CoreFoundation naming conventions dictate that functions with "Copy" in their name return objects with +1 retain count, requiring explicit release after use.

Changes:

  • Added a new NSArray.ArrayFromHandle overload that accepts a releaseHandle parameter to release the native handle after conversion
  • Fixed memory leaks across Security, CoreVideo, CoreText, CoreServices, and AddressBook frameworks by using the new overload
  • Fixed a critical bug in CTFontManager.cs where CFRetain was mistakenly called instead of CFRelease

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/Foundation/NSArray.cs Added new ArrayFromHandle<T> overload with releaseHandle parameter for proper memory management
src/Security/Trust.cs Fixed memory leak in GetCertificateChain() by releasing SecTrustCopyCertificateChain result
src/Security/SecTrust.cs Fixed memory leaks in GetPolicies() and GetCustomAnchorCertificates() by releasing Copy function results
src/CoreVideo/CVPixelFormatDescription.cs Fixed memory leak in AllTypes property by releasing CVPixelFormatDescriptionArrayCreateWithAllPixelFormatTypes result
src/CoreText/CTFontManager.cs Fixed critical bug: changed CFRetain to CFRelease in ArrayFromHandle helper method
src/CoreServices/LaunchServices.cs Fixed memory leaks in GetApplicationUrlsForUrl() and GetApplicationUrlsForBundleIdentifier() by releasing LSCopy function results
src/AddressBook/ABGroup.cs Fixed memory leaks in GetEnumerator() and GetMembers() by releasing ABGroupCopyArrayOfAllMembers result
src/AddressBook/ABAddressBook.cs Fixed memory leaks in multiple methods (GetPeople(), GetGroups(), GetAllSources()) by releasing ABAddressBookCopy function results

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

✅ [PR Build #acac6ef] Build passed (Detect API changes) ✅

Pipeline on Agent
Hash: acac6efd9bf59a9c947692ecdaa30a1dcf080f15 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

✅ [CI Build #acac6ef] Build passed (Build packages) ✅

Pipeline on Agent
Hash: acac6efd9bf59a9c947692ecdaa30a1dcf080f15 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

✅ API diff for current PR / commit

NET (empty diffs)

✅ API diff vs stable

NET (empty diffs)

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: acac6efd9bf59a9c947692ecdaa30a1dcf080f15 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

✅ [CI Build #acac6ef] Build passed (Build macOS tests) ✅

Pipeline on Agent
Hash: acac6efd9bf59a9c947692ecdaa30a1dcf080f15 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

💻 [CI Build #acac6ef] Tests on macOS X64 - Mac Sonoma (14) passed 💻

All tests on macOS X64 - Mac Sonoma (14) passed.

Pipeline on Agent
Hash: acac6efd9bf59a9c947692ecdaa30a1dcf080f15 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

💻 [CI Build #acac6ef] Tests on macOS M1 - Mac Monterey (12) passed 💻

All tests on macOS M1 - Mac Monterey (12) passed.

Pipeline on Agent
Hash: acac6efd9bf59a9c947692ecdaa30a1dcf080f15 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

💻 [CI Build #acac6ef] Tests on macOS M1 - Mac Ventura (13) passed 💻

All tests on macOS M1 - Mac Ventura (13) passed.

Pipeline on Agent
Hash: acac6efd9bf59a9c947692ecdaa30a1dcf080f15 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

💻 [CI Build #acac6ef] Tests on macOS arm64 - Mac Sequoia (15) passed 💻

All tests on macOS arm64 - Mac Sequoia (15) passed.

Pipeline on Agent
Hash: acac6efd9bf59a9c947692ecdaa30a1dcf080f15 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

💻 [CI Build #acac6ef] Tests on macOS arm64 - Mac Tahoe (26) passed 💻

All tests on macOS arm64 - Mac Tahoe (26) passed.

Pipeline on Agent
Hash: acac6efd9bf59a9c947692ecdaa30a1dcf080f15 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

🚀 [CI Build #acac6ef] Test results 🚀

Test results

✅ All tests passed on VSTS: test results.

🎉 All 131 tests passed 🎉

Tests counts

✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (iOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (MacCatalyst): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (macOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (Multiple platforms): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (tvOS): All 1 tests passed. Html Report (VSDrops) Download
✅ framework: All 2 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 4 tests passed. Html Report (VSDrops) Download
✅ generator: All 5 tests passed. Html Report (VSDrops) Download
✅ interdependent-binding-projects: All 4 tests passed. Html Report (VSDrops) Download
✅ introspection: All 6 tests passed. Html Report (VSDrops) Download
✅ linker: All 44 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 11 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 15 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 12 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 11 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ sharpie: All 1 tests passed. Html Report (VSDrops) Download
✅ windows: All 3 tests passed. Html Report (VSDrops) Download
✅ xcframework: All 4 tests passed. Html Report (VSDrops) Download
✅ xtro: All 1 tests passed. Html Report (VSDrops) Download

Pipeline on Agent
Hash: acac6efd9bf59a9c947692ecdaa30a1dcf080f15 [PR build]

@rolfbjarne rolfbjarne enabled auto-merge (squash) February 17, 2026 18:11
@rolfbjarne rolfbjarne merged commit e4ee8e3 into main Feb 18, 2026
54 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants