Ticket #2962 (closed bug: fixed)
Reduce space usage of genericLength for common Num instances
| Reported by: | thorkilnaur | Owned by: | thorkilnaur |
|---|---|---|---|
| Priority: | normal | Milestone: | 6.12 branch |
| Component: | libraries/base | Version: | 6.11 |
| Keywords: | rules, specialisation | Cc: | dons, dcoutts |
| Operating System: | Unknown/Multiple | Architecture: | Unknown/Multiple |
| Type of failure: | Difficulty: | Unknown | |
| Test Case: | Blocked By: | ||
| Blocking: | Related Tickets: |
Description
There is a space leak in genericLength:
$ ghc/stage2-inplace/ghc --interactive GHCi, version 6.11.20090116: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer ... linking ... done. Loading package base ... linking ... done. Loading package ffi-1.0 ... linking ... done. Prelude> :module +List Prelude List> genericLength [1..600000] *** Exception: stack overflow Prelude List> Prelude List> length [1..600000] 600000 Prelude List>
The attached patch against the base library provides a fix.
Best regards Thorkil
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

