Repository navigation
fix(priority): release popped element references - #90
Open
dajiaohuang wants to merge 1 commit into
Open
dajiaohuang wants to merge 1 commit into
dajiaohuang wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #90 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 6 6
Lines 639 552 -87
=========================================
- Hits 639 552 -87
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Owner
|
Thanks, the
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
priorityHeap.Popbefore shortening the slice.Priority.Get,Clear, andIteratoruse this path, so pointer-valued elements no longer remain reachable through the heap's unused backing-array slots.ExampleBlockingoutput independent of scheduler timing.Evidence
A synthetic pointer-element test against the original
mainimplementation failed: afterPriority.Getemptied a one-element queue, the backing slot still contained the returned pointer. It passes with the zeroing change.Validation
go test -mod=mod -shuffle=on -timeout 60s -coverprofile=.task-tools/coverage.txt -covermode=atomic .— pass, 100.0% statements.go test -mod=mod -shuffle=on -race -timeout 60s .— pass on Windows/amd64 (Go 1.26.3), using the task-local official llvm-mingw 20261020 UCRT x86_64 compiler.go vet ./...— pass.gofmtandgit diff --check— pass.The compiler was extracted only under the task-local tool directory; no global installation or configuration change. No real scheduler, service, or external queue was used.