René's URL Explorer Experiment


Title: isImplementedInClass leaks the losing sample instance on re-entrant or racing cache population · Issue #459 · NativeScript/ios · GitHub

Open Graph Title: isImplementedInClass leaks the losing sample instance on re-entrant or racing cache population · Issue #459 · NativeScript/ios

X Title: isImplementedInClass leaks the losing sample instance on re-entrant or racing cache population · Issue #459 · NativeScript/ios

Description: Problem MethodMeta::isImplementedInClass (NativeScript/runtime/Metadata.mm) keeps a process-wide cache of [klass alloc]-created sample instances used to answer respondsToSelector: for classes whose alloc returns a different class or whic...

Open Graph Description: Problem MethodMeta::isImplementedInClass (NativeScript/runtime/Metadata.mm) keeps a process-wide cache of [klass alloc]-created sample instances used to answer respondsToSelector: for classes whose...

X Description: Problem MethodMeta::isImplementedInClass (NativeScript/runtime/Metadata.mm) keeps a process-wide cache of [klass alloc]-created sample instances used to answer respondsToSelector: for classes whose...

Opengraph URL: https://github.com/NativeScript/ios/issues/459

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"isImplementedInClass leaks the losing sample instance on re-entrant or racing cache population","articleBody":"## Problem\n\n`MethodMeta::isImplementedInClass` (NativeScript/runtime/Metadata.mm) keeps a process-wide cache of `[klass alloc]`-created sample instances used to answer `respondsToSelector:` for classes whose `alloc` returns a different class or which forward messages. The cache is populated like this:\n\n1. `[klass alloc]` runs **outside** the mutex — deliberately, because `alloc` can trigger `+initialize`, which may run arbitrary code that re-enters this method (holding the lock would deadlock).\n2. The lock is then taken and `sampleInstances.emplace(klass, instance)` inserts.\n\nWhen the emplace **loses** — the re-entrant call already populated the entry for the same class, or another thread raced — the freshly allocated `instance` is abandoned: one leaked object per lost race (Instruments shows these as e.g. a leaked `UIAlertView` / `NSURLSessionConfiguration` attributed to `isImplementedInClass`). The count varies run to run since it is timing-dependent.\n\n## Why the obvious fixes don't work\n\n- **Releasing the loser** is unsafe: the instance is `alloc`'d but never `init`'d, so `-release` runs `-dealloc` against zero-filled ivars of an arbitrary framework class, on whatever thread the probe ran on (it demonstrably runs on worker threads). Benign for most classes, but a `-dealloc` that does `CFRelease`/`dispatch_release` on a zero ivar traps, and UIKit teardown off the main thread is asserting territory.\n- **Holding the lock across `alloc`** deadlocks via the `+initialize` re-entry described above.\n- **Parking losers in a static container** merely converts the unreachable leak into intentional perpetual retention — it silences Instruments without reclaiming anything (tried and reverted in #458).\n\n## Potential solutions\n\n- A re-entrancy-aware locking scheme (recursive mutex, or a reader/writer arrangement) so the populate path can be made atomic with respect to re-entrant probes without deadlocking through `+initialize`.\n- Reuse already-`alloc`-ed objects: when a sample for that Class is requested (or something else calls `[thatClass alloc]` through the runtime), hand out / consume the cached instance instead of allocating another, so a losing instance gets used rather than abandoned.\n\nThe leak site carries a comment pointing at this issue.","author":{"url":"https://github.com/edusperoni","@type":"Person","name":"edusperoni"},"datePublished":"2026-08-27T17:17:21Z","url":"https://github.com/NativeScript/ios/issues/459"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:e6c0845c-9cd9-ab49-7ea4-32cfeaf7123b
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idB1B2:2564F:17F1DE7:1F857C1:6B0137F3
html-safe-nonce76a58777b12e5ff15065ea3bf64b20b4d5e82709198cbaa378fff295a215ac7b
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMUIyOjI1NjRGOjE3RjFERTc6MUY4NTdDMTo2QjAxMzdGMyIsInZpc2l0b3JfaWQiOiI2ODkxNDkxODU0MzMzNTIxODAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac8fed06925e1bafd12b18aa40f4c938d2df6f18b54c9f871dbdc565418779eee7
hovercard-subject-tagissue:5270245769
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/NativeScript/ios/459/issue_layout
twitter:imagehttps://opengraph.githubassets.com/eb6479d3ffc445e5c3a97a5522e0390763a6800661c15e32dd99ca0275e5a7be/NativeScript/ios/issues/459
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/eb6479d3ffc445e5c3a97a5522e0390763a6800661c15e32dd99ca0275e5a7be/NativeScript/ios/issues/459
og:image:altProblem MethodMeta::isImplementedInClass (NativeScript/runtime/Metadata.mm) keeps a process-wide cache of [klass alloc]-created sample instances used to answer respondsToSelector: for classes whose...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameedusperoni
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
turbo-cache-controlno-preview
go-importgithub.com/NativeScript/ios git https://github.com/NativeScript/ios.git
octolytics-dimension-user_id7392261
octolytics-dimension-user_loginNativeScript
octolytics-dimension-repository_id172934359
octolytics-dimension-repository_nwoNativeScript/ios
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id172934359
octolytics-dimension-repository_network_root_nwoNativeScript/ios
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/NativeScript/ios/issues/459#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FNativeScript%2Fios%2Fissues%2F459
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FNativeScript%2Fios%2Fissues%2F459
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=NativeScript%2Fios
Reloadhttps://github.com/NativeScript/ios/issues/459
Reloadhttps://github.com/NativeScript/ios/issues/459
Reloadhttps://github.com/NativeScript/ios/issues/459
NativeScripthttps://github.com/NativeScript
ioshttps://github.com/NativeScript/ios
Codehttps://github.com/NativeScript/ios
Issues56 (56)https://github.com/NativeScript/ios/issues
Pull requests42 (42)https://github.com/NativeScript/ios/pulls
Actionshttps://github.com/NativeScript/ios/actions
Projectshttps://github.com/NativeScript/ios/projects
Security and qualityhttps://github.com/NativeScript/ios/security
Insightshttps://github.com/NativeScript/ios/insights
https://github.com/NativeScript/ios
New issuehttps://github.com/login?return_to=https://github.com/NativeScript/ios/issues/459
New issuehttps://github.com/login?return_to=https://github.com/NativeScript/ios/issues/459
isImplementedInClass leaks the losing sample instance on re-entrant or racing cache populationhttps://github.com/NativeScript/ios/issues/459#top
https://github.com/edusperoni
edusperonihttps://github.com/edusperoni
on Aug 27, 2026https://github.com/NativeScript/ios/issues/459#issue-5270245769
fix(runtime): interop memory-safety fixes from the worker memory-corruption hunt #458https://github.com/NativeScript/ios/pull/458
edusperonihttps://github.com/edusperoni
on Aug 27, 2026https://github.com/NativeScript/ios/issues/459#event-30119612308
docs(runtime): document the known losing-emplace leak in isImplemente…https://github.com/NativeScript/ios/commit/efcec448b604ee4f31efa286f87c9eb683bdd3d9
efcec44https://github.com/NativeScript/ios/commit/efcec448b604ee4f31efa286f87c9eb683bdd3d9
https://github.com/edusperoni
edusperonihttps://github.com/edusperoni
on Aug 27, 2026https://github.com/NativeScript/ios/issues/459#issuecomment-5442756503
edusperonihttps://github.com/edusperoni
on Aug 27, 2026https://github.com/NativeScript/ios/issues/459#event-30120452653
fix(runtime): interop memory-safety fixes from the worker memory-corr…https://github.com/NativeScript/ios/commit/5d4569c197810cdd4c1e02e7c16d42a01a77d5c0
5d4569chttps://github.com/NativeScript/ios/commit/5d4569c197810cdd4c1e02e7c16d42a01a77d5c0
Sign up for freehttps://github.com/signup?return_to=https://github.com/NativeScript/ios/issues/459
Sign in to commenthttps://github.com/login?return_to=https://github.com/NativeScript/ios/issues/459
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.