Opened 3 years ago

Closed 3 years ago

#12804 closed bug (invalid)

forever contains a space leak

Reported by: tomjaguarpaw Owned by:
Priority: normal Milestone:
Component: libraries/base Version: 8.0.1
Keywords: Cc: ekmett, core-libraries-committee@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Runtime performance bug Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

4.9.0.0's forever (implemented in terms of Applicative) has a space leak for certain base Monads. The old forever (implemented in terms of Monad) does not.

See these messages for details

This is not necessarily forever's fault. It seems likely that the broken behaviour that occurs with ReaderT and StateT (on IO) could be fixed by a specialised implementation of *> (for ReaderT and StateT).

Perhaps, then, this bug should ultimately be fixed in transformers (and various other packages which supply Applicatives) but it is a regression introduced by base-4.9.0.0 so I think it's worthwhile to discuss here.

Change History (5)

comment:1 Changed 3 years ago by tomjaguarpaw

I confirm that the space leak is gone for ReaderT of IO if I define

f *> v  = ReaderT $ \ r -> runReaderT f r *> runReaderT v r

I presume (but haven't checked) that the space leak is also gone for StateT of IO if the corresponding implementation for *> is given in the Applicative instance.

comment:2 Changed 3 years ago by simonpj

Cc: ekmett core-libraries-committee@… added

Adding Edward and the core libraries committee; it's their territory.

comment:3 Changed 3 years ago by tomjaguarpaw

Ultimately I conclude that the issue lies in transformers, not base. I filed this issue on transformers:

http://hub.darcs.net/ross/transformers/issue/33

comment:4 Changed 3 years ago by bgamari

The transformers patch has been merged. Let's hope that Ross releases soon so we can bump the submodule included in 8.0.2.

Last edited 3 years ago by bgamari (previous) (diff)

comment:5 Changed 3 years ago by bgamari

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.