Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
GHC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ian-Woo Kim
GHC
Commits
b066d936
Commit
b066d936
authored
7 years ago
by
Andrew Martin
Committed by
Ben Gamari
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
base: Improve docs to clarify when finalizers may not be run
parent
927e7810
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libraries/base/System/Mem/Weak.hs
+26
-0
26 additions, 0 deletions
libraries/base/System/Mem/Weak.hs
with
26 additions
and
0 deletions
libraries/base/System/Mem/Weak.hs
+
26
−
0
View file @
b066d936
...
...
@@ -67,6 +67,10 @@ module System.Mem.Weak (
-- * A precise semantics
-- $precise
-- * Implementation notes
-- $notes
)
where
import
GHC.Weak
...
...
@@ -140,3 +144,25 @@ A heap object is /reachable/ if:
* It is the value or finalizer of a weak pointer object whose key is reachable.
-}
{- $notes
A finalizer is not always called after its weak pointer\'s object becomes
unreachable. There are two situations that can cause this:
* If the object becomes unreachable right before the program exits,
then GC may not be performed. Finalizers run during GC, so finalizers
associated with the object do not run if GC does not happen.
* If a finalizer throws an exception, subsequent finalizers that had
been queued to run after it do not get run. This behavior may change
in a future release. See issue <https://ghc.haskell.org/trac/ghc/ticket/13167 13167>
on the issue tracker. Writing a finalizer that throws exceptions is
discouraged.
Other than these two caveats, users can always expect that a finalizer
will be run after its weak pointer\'s object becomes unreachable. However,
the second caveat means that users need to trust that all of their
transitive dependencies do not throw exceptions in finalizers, since
any finalizers can end up queued together.
-}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment