[GHC] #13148: Adding weak pointers to non-mutable unboxed values segfaults

GHC ghc-devs at haskell.org
Wed Jan 18 16:05:52 UTC 2017


#13148: Adding weak pointers to non-mutable unboxed values segfaults
-------------------------------------+-------------------------------------
        Reporter:  mboes             |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by rwbarton):

 A `Ptr` is a wrapper around `Addr#` in the same way that `Int` is a
 wrapper around `Int#`. The `Ptr` itself has no meaningful lifetime or
 identity (unlike the underlying memory pointed to by the pointer). So yes,
 attaching a finalizer to a `Ptr` will not be useful.

 Using `Ptr` is entirely equivalent to programming in C with manual memory
 management; the Haskell GC can't help you here. `Ptr` really might just as
 well be `Int` as far as Haskell is concerned.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13148#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list