
#9923: Offer copy-on-GC sliced arrays -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: simonmar Type: feature request | Status: new Priority: normal | Milestone: Component: Runtime System | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by dfeuer): Replying to [comment:1 svenpanne]:
Hmmm, I doubt that this would work: The proposal means that the garbage
collector must allocate memory during collections, which is quite the opposite what it is supposed to do. Put another way: If somebody (SimonM?) thinks that this is possible, I would be very interested in the details. Even if this somehow works, there are several pathological cases like having lots of 999999-element slices of a 1000000-element array. > > Short-circuiting projection functions is OK (IIRC nhc did that first) because one doesn't have to allocate, but slicing is not really projecting.
Yes, it would have to allocate while collecting, but I think this happens anyway. As for pathological cases, "Doctor! It hurts when I do ''this''! Don't do that." The suggested mechanism would not replace the usual sort of array slicing in general; it would be an alternative mechanism for situations where it was useful. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9923#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler