-
-
Notifications
You must be signed in to change notification settings - Fork 411
Fix issue 18996 - ProtoGC should support removing roots and ranges that were not originally added #2220
Conversation
that were not originally added. Behavior is now consistent with conservative GC.
|
Thanks for your pull request, @schveiguy! Bugzilla references
Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub fetch digger
dub run digger -- build "stable + druntime#2220" |
|
ping @MartinNowak this should go into 2.081.0, it's a regression. |
|
@schveiguy as long as it's targeted on stable (which it is) and merged before the end of this month, it will be part of the final 2.081 |
rainers
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. The documentation in core.memory also states that nothing happens for null or unknown pointers.
The implementation is still slightly different, because the GC does not remember adding a root or range twice, so a single removeRoot/Range can lead to subtle bugs. ProtoGC remembers identical roots/ranges multiple times, so might keep them alive longer.
That's a simple fix as well, just don't return :) |
|
I think jenkins wasn't coming back with a test, apparently you have to close and reopen. |
|
@schveiguy ci.dlang.io is currently down. It will never reply. |
|
Hm... so I guess I'll use the auto-tester to merge. Thanks for the update. |
|
Auto-merge toggled on |
That won't help you, because it can't merge when there are required CI checks that haven't passed yet. |
|
Ah thanks, I was confusing this case with the one where the bot won't merge when non-required CIs haven't reported. |
Yes, but I think the returning API is much saner. If you have two independent sources that happen to add the same root/range, it is very likely that the root/range is still in use after one source has released it. |
Agreed. So maybe it's the conservative GC that needs updating. |
The original behavior was to assert(false), but this is inconsistent with the standard GC, which ignores removal of ranges it didn't already know about.
The code in question,
Array!string, whenever it would realloc, it would removeRange on the previous array, and addRange on the new one. Since it starts out with a null array,removeRange(null)was called.Arguably, this is not behavior we want (
Arraycould easily be changed to not try andremoveRange(null)), but theProtoGCshouldn't behave differently from the actual GC while it is in charge of things.Added a simple test to make sure this doesn't happen again.