Skip to content

Expose retained memory estimates - #1174

Open
mjackson wants to merge 1 commit into
ada-url:mainfrom
mjackson:retained-memory-estimates
Open

Expose retained memory estimates#1174
mjackson wants to merge 1 commit into
ada-url:mainfrom
mjackson:retained-memory-estimates

Conversation

@mjackson

Copy link
Copy Markdown
  • Add allocation-free retained-capacity estimates for url_aggregator and url_search_params
  • Expose equivalent C APIs that include each opaque handle's owning result block
  • Use saturating arithmetic so embedders can safely report external memory to their garbage collector

This lets embedders account for Ada-owned URL and query-list storage without inspecting private layout or allocating during GC.

Expose allocator-independent URL and URLSearchParams capacity estimates through both the C++ and C APIs, with saturating arithmetic and growth coverage.
@anonrig
anonrig requested a review from lemire July 10, 2026 23:35

@anonrig anonrig left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. Thank you for the PR

@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.85714% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.94%. Comparing base (761db09) to head (70730e9).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/url_search_params.cpp 83.33% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1174      +/-   ##
==========================================
+ Coverage   59.79%   59.94%   +0.15%     
==========================================
  Files          37       38       +1     
  Lines        6121     6149      +28     
  Branches     2978     2982       +4     
==========================================
+ Hits         3660     3686      +26     
  Misses        618      618              
- Partials     1843     1845       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@lemire

lemire commented Jul 11, 2026

Copy link
Copy Markdown
Member

@mjackson What is the purpose here?

Will every little component of out software systems have a memory estimator bundled with it?

What function does the estimator serve?

How often are systems memory limited because they are storing too much data related to URLs?

Are you going to be using this personally in a significant manner? Can you describe the usage you have in mind?

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.

3 participants