-
-
Notifications
You must be signed in to change notification settings - Fork 424
Conversation
- Release such memory explicitly by `destroy`ing the main thread on threading module termination - Remove explicit _tlsRanges.popBack call as now _tlsRanges will have already been released in that case via core.thread.thread_term -> ~Thread on the main thread -> rt.tlsgc.destroy -> rt.sections.finiTLSRanges
Thanks for your pull request, @Calrama! We are looking forward to reviewing it, and you should be hearing from a maintainer soon. Some tips to help speed things up:
Bear in mind that large or tricky changes may require multiple rounds of review and revision. Please see CONTRIBUTING.md for more information. Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. |
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
@@ -461,8 +461,6 @@ extern(C) void _d_dso_registry(CompilerDSOData* data) | |||
else | |||
{ | |||
// static DSOs are unloaded in reverse order | |||
assert(pdso._tlsSize == _tlsRanges.back.length); | |||
_tlsRanges.popBack(); |
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.
Just to check - this is called once per the executable, not once per thread, right? Meaning, _tlsRanges
will have just one element.
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.
Before this PR, yes. With this PR _tlsRanges
will have no elements at that time (and the .popBack
will thus result in an AssertError
, which is why I removed it), because it was already .clear
ed via thread_term
(as per PR description).
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.
Yes, just wanted to confirm that!
Just FYI, since I saw this mentioned on the newsgroup :). I'm back from a holiday next week, and will give this a more detailed look then, if nobody does by then. It looked fine to me last time I checked. |
@Burgos, do you have time to give this PR a more detailed look? |
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 too. As no one has given feedback on this for a very long time, it's a tiny fix and many people haven't seen any issue, I think we should move forward with this.
Yes, indeeed. LGTM! |
Solves the problem described in #1557 (which got stalled)
destroy
ingthe main thread on threading module termination
rt.sections_elf_shared.finiTLSRanges
already contains the necessary logic toreset
_tlsRanges
to zero length in the notShared
version, it just isn't used; instead the_tlsRanges
(which only have one element) are cleared by calling_tlsRanges.popBack
in_d_dso_registry
.This PR removes that
popBack
call and instead uses the preexisting logic infiniTLSRanges
viacore.thread.thread_term -> ~Thread on the main thread -> rt.tlsgc.destroy -> rt.sections.finiTLSRanges