René's URL Explorer Experiment
Title: feat(runtime): arrays WinRT hands back, String[]/object arrays, boxed-argument leak by triniwiz · Pull Request #44 · NativeScript/windows · GitHub
Open Graph Title: feat(runtime): arrays WinRT hands back, String[]/object arrays, boxed-argument leak by triniwiz · Pull Request #44 · NativeScript/windows
X Title: feat(runtime): arrays WinRT hands back, String[]/object arrays, boxed-argument leak by triniwiz · Pull Request #44 · NativeScript/windows
Description: Follows #41. Arrays now convert in both directions for every element type, on both engines, including arrays WinRT allocates and hands back. Before, those were refused when the call was built ("Unsupported array return type"). Three commits:
1. Arrays WinRT hands back
A received array takes two ABI slots, UINT32* length and T** data. MethodCall and PropertyCall lay these out for:
array return values and array-typed property getters, which land in the call's return buffer;
ByRef T[] parameters, as two out slots.
After the call, (length, data) is converted and the CoTaskMem array freed. The element type comes from classify_return, through the new ReturnKind::Array { element, element_type, size }:
element
JS value
primitives (UInt8 … Double, Boolean, Char16, enums)
typed array of the matching kind, the same kinds interop.Array.create returns
String
array of strings
classes, interfaces, Object
array of wrappers (null for null)
structs, Guid
array of struct objects
String and object elements are taken over by the conversion, so nothing is left to release. Out parameters behave as they do for other types: classic accepts interop.out() or returns [result, ...outs]; napi needs interop.out().
const out = interop.out();
CryptographicBuffer.CopyToByteArray(buffer, out); // out.value: Uint8Array
Windows.Graphics.Display.DisplayServices.FindAll(); // [{ Value: 65537 }]
new ListBoxAutomationPeer(list).GetSelection(); // [wrapper, wrapper]
certificateExtension.Value; // Uint8Array
Boxed arrays: IReferenceArray values (from PropertyValue.Create*Array, a PropertySet, settings, device properties) unbox the way boxed scalars already do, through IPropertyValue.Get*Array and the same conversion. In the other direction, an Object parameter boxes these with PropertyValue, so a returned array can be passed back:
typed arrays, which box as the matching IReferenceArray;
plain arrays whose elements are all strings, all numbers (Int32[] when they're all 32-bit integers, Double[] otherwise), all booleans, or all WinRT objects (or null).
2. Boxed Object arguments no longer leak
Every JS value boxed for an Object parameter (strings, numbers, booleans, struct shapes, and now arrays) used to forget its reference, so each argument leaked its box. Each call now opens a BoxedArgs scope, and the boxes made while parsing its arguments are released when the call returns. A call made during argument parsing (e.g. from a getter) opens its own scope and releases only its own boxes.
Inserting the same values into a PropertySet 200k times (napi, memory after GC):
value
before
after
2 KB string
+1087 MB
+262 MB
Float64Array(256)
+693 MB
+262 MB
number
+285 MB
+262 MB
existing WinRT object (no boxing)
+262 MB
+261 MB
The ~262 MB the no-boxing row still shows isn't a leak. It's napi finalizers waiting for the event loop, which this synchronous loop never yields to. With the loop yielding between 50k-call batches, memory levels off after a few batches.
3. String[] and object arrays passed in or filled
Passed in (PropertyValue.CreateStringArray, IVector.ReplaceAll, …): a JS array becomes HSTRINGs, or objects queried to the element's interface. They're released after the call.
Filled by the callee (IVector.GetMany): the caller passes a JS array as long as the slots it wants, and the results are written back into that array. interop.Array.create('String', n), ('Object', n) or ('Windows.Data.Json.IJsonValue', n) returns an array of nulls for this.
Fill parameters are recognized by the [out] param attribute (ParameterDeclaration::is_fill_array).
GenericMethodCall, which is only used for open generic interfaces, refuses these arrays rather than passing them as bytes.
Testing
Rust unit tests:
array classification and layout
string/object element resolution
a box/unbox round trip through PropertyValue that frees the returned HSTRINGs
End-to-end, 24/24 on Node with windows-napi, 23/23 on classic V8 (the XAML check needs a XAML host):
out byte[], including an empty one
struct-array return
boxed arrays of every primitive kind
String[]/Object[] passed in, and round trips through PropertySet
IVector.ReplaceAll/GetMany, and GetMany returning the filled count
IVector.ReplaceAll/GetMany
CertificateExtension.Value set and get
ListBoxAutomationPeer.GetSelection() in a live XamlWindow
Existing suites:
windows-napi npm test: 442/442
the #41 end-to-end checks: 27/27 napi, 24/24 classic
the events checks: 26/26
cargo test -p runtime --lib: the same failures as main
Not covered:
IReferenceArray.Value called directly on an interface instance. It goes through the same property path, but boxed arrays now unbox before JS can reach that member, so I couldn't test it.
Struct arrays passed in (e.g. PropertyValue.CreatePointArray).
Open Graph Description: Follows #41. Arrays now convert in both directions for every element type, on both engines, including arrays WinRT allocates and hands back. Before, those were refused when the call was built (&quo...
X Description: Follows #41. Arrays now convert in both directions for every element type, on both engines, including arrays WinRT allocates and hands back. Before, those were refused when the call was built (&...
Opengraph URL: https://github.com/NativeScript/windows/pull/44
X: @github
direct link
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:77e81f19-51ad-0f3e-63d8-93cf5581b253 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | A238:785A9:20ED5C1:29B9621:6B01713E |
| html-safe-nonce | c0334458d80b1330391c8308ced3c4caf7c985f112c604dceeef37fc0bfb46b5 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMjM4Ojc4NUE5OjIwRUQ1QzE6MjlCOTYyMTo2QjAxNzEzRSIsInZpc2l0b3JfaWQiOiIyMDI2NDQyMjk3MzQzODMyMzgyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | d00ed24909c0981f1573d5f77b4e02e74dae2db8d40aeceb6011eee384d79d8f |
| hovercard-subject-tag | pull_request:5184734606 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | ///pull_requests/show/files |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/NativeScript/windows/pull/44/files |
| twitter:image | https://avatars.githubusercontent.com/u/6695919?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/6695919?s=400&v=4 |
| og:image:alt | Follows #41. Arrays now convert in both directions for every element type, on both engines, including arrays WinRT allocates and hands back. Before, those were refused when the call was built (&quo... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/NativeScript/windows git https://github.com/NativeScript/windows.git |
| octolytics-dimension-user_id | 7392261 |
| octolytics-dimension-user_login | NativeScript |
| octolytics-dimension-repository_id | 373653886 |
| octolytics-dimension-repository_nwo | NativeScript/windows |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 373653886 |
| octolytics-dimension-repository_network_root_nwo | NativeScript/windows |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
| Skip to content | https://github.com/NativeScript/windows/pull/44/files#start-of-content |
| https://github.com/ |
| Sign in | https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FNativeScript%2Fwindows%2Fpull%2F44%2Ffiles |
| GitHubRepository hosting, code review, and collaboration | https://github.com/platform |
| CopilotAI coding agent for tasks, projects, and automated work | https://github.com/features/copilot |
| ActionsCI/CD and automation | https://github.com/features/actions |
| Code QualityQuality analysis, fixes, and enforcement | https://github.com/features/code-quality |
| CodespacesCloud development environments | https://github.com/features/codespaces |
| Code SecurityVulnerability detection and remediation | https://github.com/security/advanced-security/code-security |
| Secret ProtectionSecret scanning and leak prevention | https://github.com/security/advanced-security/secret-protection |
| All Features | https://github.com/features |
| Documentation | https://docs.github.com/en |
| Training | https://learn.github.com/skills |
| Certifications | https://learn.github.com/credentials |
| Build with Copilot | https://github.com/features/ai |
| Customize Copilot | https://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview |
| Integrations | https://github.com/marketplace |
| Trending repos | https://github.com/trending |
| GitHub Sponsors | https://github.com/open-source/sponsors |
| Developer articles | https://github.com/resources/articles |
| ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place. | https://github.blog/changelog/ |
| Enterprises | https://github.com/enterprise |
| Team | https://github.com/team |
| Startups | https://github.com/enterprise/startups |
| Nonprofits | https://github.com/solutions/industry/nonprofits |
| Healthcare | https://github.com/solutions/industry/healthcare |
| Financial services | https://github.com/solutions/industry/financial-services |
| Manufacturing | https://github.com/solutions/industry/manufacturing |
| Government | https://github.com/solutions/industry/government |
| See all industries | https://github.com/solutions/industry |
| Why GitHub | https://github.com/why-github |
| Customer Stories | https://github.com/customer-stories |
| Business insights | https://github.com/solutions/executive-insights |
| Trust Center | https://github.com/trust-center |
| GitHub Advanced SecurityEnterprise-grade code security | https://github.com/security/advanced-security |
| Copilot for businessEnterprise-grade AI features | https://github.com/features/copilot/copilot-business |
| Premium SupportEnterprise-grade 24/7 support | https://github.com/enterprise/premium-support |
| Documentation | https://docs.github.com/en |
| Resource center | https://github.com/resources |
| Blog | https://github.blog/ |
| Events & webinars | https://github.com/resources/events |
| Community Forum | https://github.com/orgs/community/discussions |
| Customer Stories | https://github.com/customer-stories |
| Integrations | https://github.com/marketplace |
| Customer support | https://help.github.com/ |
| Training | https://learn.github.com/skills |
| GitHub Status | https://www.githubstatus.com/ |
| About | https://github.com/about |
| Partners | https://github.com/partners |
| Changelog | https://github.blog/changelog/ |
| GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub. | https://githubuniverse.com/ |
| Pricing | https://github.com/pricing |
| Sign in | https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FNativeScript%2Fwindows%2Fpull%2F44%2Ffiles |
| Sign up | https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=NativeScript%2Fwindows |
| Reload | https://github.com/NativeScript/windows/pull/44/files |
| Reload | https://github.com/NativeScript/windows/pull/44/files |
| Reload | https://github.com/NativeScript/windows/pull/44/files |
| NativeScript | https://github.com/NativeScript |
| windows | https://github.com/NativeScript/windows |
| Code | https://github.com/NativeScript/windows |
| Issues | https://github.com/NativeScript/windows/issues |
| Pull requests | https://github.com/NativeScript/windows/pulls |
| Actions | https://github.com/NativeScript/windows/actions |
| Projects | https://github.com/NativeScript/windows/projects |
| Security and quality | https://github.com/NativeScript/windows/security |
| Insights | https://github.com/NativeScript/windows/insights |
| Sign up for GitHub
| https://github.com/signup?return_to=%2FNativeScript%2Fwindows%2Fissues%2Fnew%2Fchoose |
| terms of service | https://docs.github.com/terms |
| privacy statement | https://docs.github.com/privacy |
| Sign in | https://github.com/login?return_to=%2FNativeScript%2Fwindows%2Fissues%2Fnew%2Fchoose |
| triniwiz | https://github.com/triniwiz |
| main | https://github.com/NativeScript/windows/tree/main |
| feat/winrt-received-arrays | https://github.com/NativeScript/windows/tree/feat/winrt-received-arrays |
|
Conversation
1
| https://github.com/NativeScript/windows/pull/44 |
|
Commits
3
| https://github.com/NativeScript/windows/pull/44/commits |
|
Checks
3
| https://github.com/NativeScript/windows/pull/44/checks |
|
Files changed
| https://github.com/NativeScript/windows/pull/44/files |
| Please reload this page | https://github.com/NativeScript/windows/pull/44/files |
|
feat(runtime): arrays WinRT hands back, String[]/object arrays, boxed-argument leak
| https://github.com/NativeScript/windows/pull/44/files#top |
|
Show all changes
3 commits
| https://github.com/NativeScript/windows/pull/44/files |
|
c8f2046
feat(runtime): arrays WinRT hands back
triniwiz Nov 6, 2026
| https://github.com/NativeScript/windows/pull/44/commits/c8f20469d9b6539895046f6b2c8543f888bcbf9e |
|
c8b4c22
fix(runtime): release values boxed for Object arguments
triniwiz Nov 6, 2026
| https://github.com/NativeScript/windows/pull/44/commits/c8b4c22fa19474f3b2b9dd5ff71544ac0243d446 |
|
6038bfb
feat(runtime): String[] and object arrays, array properties
triniwiz Nov 6, 2026
| https://github.com/NativeScript/windows/pull/44/commits/6038bfb64654fe501de87310e2897e836287023e |
|
Clear filters
| https://github.com/NativeScript/windows/pull/44/files |
| Please reload this page | https://github.com/NativeScript/windows/pull/44/files |
| Please reload this page | https://github.com/NativeScript/windows/pull/44/files |
|
generic_method_call.rs
| https://github.com/NativeScript/windows/pull/44/files#diff-71421984375b6b9dd63bc0908d9ec6c463141a97518c21c2e9d5b51640f6024c |
|
helpers.rs
| https://github.com/NativeScript/windows/pull/44/files#diff-b808d86633f8a3ca7923bd79eb98c11bc3f0828e00cf7c61e53929da22c29646 |
|
interop_array.js
| https://github.com/NativeScript/windows/pull/44/files#diff-77e9df3a48fc049405c2e916905a318a1c2ee2df6f521f6b21e9d7bcd3d7c6b3 |
|
lib.rs
| https://github.com/NativeScript/windows/pull/44/files#diff-0ec06ea58bd455f09ce6b3bb4c2c1c0d37bda51c1e1be2151c560c9c973959ec |
|
method_call.rs
| https://github.com/NativeScript/windows/pull/44/files#diff-d4b5f479d079a3be6b69b2f97b43385a30a402a0a07b0e55d710e1889a5037b7 |
|
invoke.rs
| https://github.com/NativeScript/windows/pull/44/files#diff-a71b6d3125c86a3f68d6b2bec8999f8cb26b0a9d8cd09416ab3cc6157894863b |
|
value.rs
| https://github.com/NativeScript/windows/pull/44/files#diff-afbb6e4c6b2910a255031ed59d437805332e450e97f8741c88a79a31ee633ce9 |
|
ns_proxy.rs
| https://github.com/NativeScript/windows/pull/44/files#diff-4c3e3ecccee261330328e252ad6b51d285d51f9e847767f39ee182b9ed982346 |
|
property_call.rs
| https://github.com/NativeScript/windows/pull/44/files#diff-ab9dad0dc50de9a4d6e7e30abb9268e2699ff54930bae109f36f873815b196ef |
|
value.rs
| https://github.com/NativeScript/windows/pull/44/files#diff-bfca47ce3812b16f4018e8b00fe715af33c5d5c2eb0e556df3de3bc09ef604a6 |
|
nswinrt-helpers.d.ts
| https://github.com/NativeScript/windows/pull/44/files#diff-12dfb999ac845b06c0cee34ad31fd7f8f8516c7994eeac8d70aa44e4d3043668 |
| runtime/src/generic_method_call.rs | https://github.com/NativeScript/windows/pull/44/files#diff-71421984375b6b9dd63bc0908d9ec6c463141a97518c21c2e9d5b51640f6024c |
|
View file
| https://github.com/NativeScript/windows/blob/6038bfb64654fe501de87310e2897e836287023e/runtime/src/generic_method_call.rs |
|
Open in desktop
| https://desktop.github.com |
| https://github.co/hiddenchars |
| https://github.com/NativeScript/windows/pull/44/{{ revealButtonHref }} |
|
| https://github.com/NativeScript/windows/pull/44/files#diff-71421984375b6b9dd63bc0908d9ec6c463141a97518c21c2e9d5b51640f6024c |
|
| https://github.com/NativeScript/windows/pull/44/files#diff-71421984375b6b9dd63bc0908d9ec6c463141a97518c21c2e9d5b51640f6024c |
|
| https://github.com/NativeScript/windows/pull/44/files#diff-71421984375b6b9dd63bc0908d9ec6c463141a97518c21c2e9d5b51640f6024c |
|
| https://github.com/NativeScript/windows/pull/44/files#diff-71421984375b6b9dd63bc0908d9ec6c463141a97518c21c2e9d5b51640f6024c |
| runtime/src/helpers.rs | https://github.com/NativeScript/windows/pull/44/files#diff-b808d86633f8a3ca7923bd79eb98c11bc3f0828e00cf7c61e53929da22c29646 |
|
View file
| https://github.com/NativeScript/windows/blob/6038bfb64654fe501de87310e2897e836287023e/runtime/src/helpers.rs |
|
Open in desktop
| https://desktop.github.com |
| Please reload this page | https://github.com/NativeScript/windows/pull/44/files |
| runtime/src/js/interop_array.js | https://github.com/NativeScript/windows/pull/44/files#diff-77e9df3a48fc049405c2e916905a318a1c2ee2df6f521f6b21e9d7bcd3d7c6b3 |
|
View file
| https://github.com/NativeScript/windows/blob/6038bfb64654fe501de87310e2897e836287023e/runtime/src/js/interop_array.js |
|
Open in desktop
| https://desktop.github.com |
| https://github.co/hiddenchars |
| https://github.com/NativeScript/windows/pull/44/{{ revealButtonHref }} |
|
| https://github.com/NativeScript/windows/pull/44/files#diff-77e9df3a48fc049405c2e916905a318a1c2ee2df6f521f6b21e9d7bcd3d7c6b3 |
|
| https://github.com/NativeScript/windows/pull/44/files#diff-77e9df3a48fc049405c2e916905a318a1c2ee2df6f521f6b21e9d7bcd3d7c6b3 |
| runtime/src/lib.rs | https://github.com/NativeScript/windows/pull/44/files#diff-0ec06ea58bd455f09ce6b3bb4c2c1c0d37bda51c1e1be2151c560c9c973959ec |
|
View file
| https://github.com/NativeScript/windows/blob/6038bfb64654fe501de87310e2897e836287023e/runtime/src/lib.rs |
|
Open in desktop
| https://desktop.github.com |
| https://github.co/hiddenchars |
| https://github.com/NativeScript/windows/pull/44/{{ revealButtonHref }} |
|
| https://github.com/NativeScript/windows/pull/44/files#diff-0ec06ea58bd455f09ce6b3bb4c2c1c0d37bda51c1e1be2151c560c9c973959ec |
|
| https://github.com/NativeScript/windows/pull/44/files#diff-0ec06ea58bd455f09ce6b3bb4c2c1c0d37bda51c1e1be2151c560c9c973959ec |
|
| https://github.com/NativeScript/windows/pull/44/files#diff-0ec06ea58bd455f09ce6b3bb4c2c1c0d37bda51c1e1be2151c560c9c973959ec |
|
| https://github.com/NativeScript/windows/pull/44/files#diff-0ec06ea58bd455f09ce6b3bb4c2c1c0d37bda51c1e1be2151c560c9c973959ec |
|
| https://github.com/NativeScript/windows/pull/44/files#diff-0ec06ea58bd455f09ce6b3bb4c2c1c0d37bda51c1e1be2151c560c9c973959ec |
|
| https://github.com/NativeScript/windows/pull/44/files#diff-0ec06ea58bd455f09ce6b3bb4c2c1c0d37bda51c1e1be2151c560c9c973959ec |
| Please reload this page | https://github.com/NativeScript/windows/pull/44/files |
|
| https://github.com |
| Terms | https://docs.github.com/site-policy/github-terms/github-terms-of-service |
| Privacy | https://docs.github.com/site-policy/privacy-policies/github-privacy-statement |
| Security | https://github.com/security |
| Status | https://www.githubstatus.com/ |
| Community | https://github.community/ |
| Docs | https://docs.github.com/ |
| Contact | https://support.github.com?tags=dotcom-footer |
Viewport: width=device-width
URLs of crawlers that visited me.