[GHC] #10904: C finalizer may be called on re-used memory
GHC
ghc-devs at haskell.org
Tue Sep 22 08:00:12 UTC 2015
#10904: C finalizer may be called on re-used memory
-------------------------------------+-------------------------------------
Reporter: bherzog | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Runtime System | Version: 7.4.1
Resolution: | Keywords:
Operating System: Linux | Architecture:
| Unknown/Multiple
Type of failure: Runtime crash | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Revisions:
-------------------------------------+-------------------------------------
Comment (by simonmar):
I looked at the code, and I think you're right, there does seem to be a
possibility that the finalizer will run after the memory has been
reclaimed. As a workaround you can follow the suggestion you made, namely
use `mallocBytes` and then `newForeignPtr`.
I'll think about how this can be fixed. It's tricky, and we already have
too much overhead for C finalizers (things got a lot more complicated
during the recent changes to ensure ordering for finalizers, I think
that's when the bug may have crept in).
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10904#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list