Skip to content

WeakPool: GC pool based on weak.Pool#123

Merged
arnodel merged 2 commits into
lua5.5from
weakpool
Feb 14, 2026
Merged

WeakPool: GC pool based on weak.Pool#123
arnodel merged 2 commits into
lua5.5from
weakpool

Conversation

@arnodel

@arnodel arnodel commented Feb 14, 2026

Copy link
Copy Markdown
Owner

Since go 1.24 weak pointers are available via the weak stdlib package. This means we can now have a GC pool with similar characteristics as luagc.UnsafePool but implemented safely in Go. We get further simplifications by using runtime.AddCleanup instead of runtime.SetFinalizer.

We could remove all other luagc.Pool implementations in the future I think but for now that would mean we require go1.24 (which is a big just from go1.18 currently)

weakpool is based on weak.Pointer, only works on go 1.24+
@arnodel arnodel changed the base branch from lua5.4 to lua5.5 February 14, 2026 16:09
@codecov

codecov Bot commented Feb 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 81.55340% with 38 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.36%. Comparing base (63a9cb6) to head (4470ace).
⚠️ Report is 25 commits behind head on lua5.5.

Files with missing lines Patch % Lines
runtime/internal/luagc/registry.go 16.66% 20 Missing ⚠️
runtime/weakpool.go 95.12% 7 Missing and 1 partial ⚠️
runtime/runtime.go 22.22% 5 Missing and 2 partials ⚠️
runtime/internal/luagc/clonepool.go 50.00% 0 Missing and 1 partial ⚠️
runtime/internal/luagc/safepool.go 50.00% 0 Missing and 1 partial ⚠️
runtime/internal/luagc/unsafepool.go 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           lua5.5     #123       +/-   ##
===========================================
- Coverage   80.79%   67.36%   -13.43%     
===========================================
  Files         168      170        +2     
  Lines       15144    15602      +458     
===========================================
- Hits        12235    10511     -1724     
- Misses       2549     4756     +2207     
+ Partials      360      335       -25     

☔ View full report in Codecov by Sentry.
📢 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.

@arnodel arnodel merged commit 437760f into lua5.5 Feb 14, 2026
31 of 32 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.

1 participant