Monad Transformer Space Leak

Hi everyone! For some reason, this leaks thunks: module Main where import Control.Monad import Control.Monad.MC -- from monte-carlo import Control.Monad.ST.Strict go :: Int -> MCT (ST s) () go k = replicateM_ k (return ()) main = print $ runST $ evalMCT (go 100000000) rng where rng = mt19937 0 while this does not: module Main where import Control.Monad import Control.Monad.MC go :: Int -> MC () go k = replicateM_ k (return ()) main = print $ evalMC (go 100000000) rng where rng = mt19937 0 Can anyone help me figure out what's going on here? Thanks, - Clark

More interestingly, the problem goes away if I enable profiling. That's kind of worrisome. - Clark On Monday, April 22, 2013, Clark Gaebel wrote:
Hi everyone!
For some reason, this leaks thunks:
module Main where
import Control.Monad import Control.Monad.MC -- from monte-carlo import Control.Monad.ST.Strict
go :: Int -> MCT (ST s) () go k = replicateM_ k (return ())
main = print $ runST $ evalMCT (go 100000000) rng where rng = mt19937 0
while this does not:
module Main where
import Control.Monad import Control.Monad.MC
go :: Int -> MC () go k = replicateM_ k (return ())
main = print $ evalMC (go 100000000) rng where rng = mt19937 0
Can anyone help me figure out what's going on here?
Thanks, - Clark

Hi, Am Montag, den 22.04.2013, 16:44 -0400 schrieb Clark Gaebel:
More interestingly, the problem goes away if I enable profiling. That's kind of worrisome.
this part sounds similar than the recently discussed problem with the ackermann function (http://hackage.haskell.org/trac/ghc/ticket/7850) – maybe your code is only allocating stacks and nothing else? In that case you can try with GHC HEAD and see if the problem is fixed. Greetings, Joachim -- Joachim "nomeata" Breitner Debian Developer nomeata@debian.org | ICQ# 74513189 | GPG-Keyid: 4743206C JID: nomeata@joachim-breitner.de | http://people.debian.org/~nomeata

I don't have a copy of GHC HEAD handy, and don't have the time to set up the ecosystem myself to test this one bug. Would someone else with a copy lying around mind testing it out for me? Thanks, - Clark On Monday, April 22, 2013, Joachim Breitner wrote:
Hi,
Am Montag, den 22.04.2013, 16:44 -0400 schrieb Clark Gaebel:
More interestingly, the problem goes away if I enable profiling. That's kind of worrisome.
this part sounds similar than the recently discussed problem with the ackermann function (http://hackage.haskell.org/trac/ghc/ticket/7850) – maybe your code is only allocating stacks and nothing else? In that case you can try with GHC HEAD and see if the problem is fixed.
Greetings, Joachim
-- Joachim "nomeata" Breitner Debian Developer nomeata@debian.org javascript:; | ICQ# 74513189 | GPG-Keyid: 4743206C JID: nomeata@joachim-breitner.de javascript:; | http://people.debian.org/~nomeata

I tested it on GHC 6.12.1, which wasn't affected by the recent "ackermann"
bug, but still it leaks memory.
Petr Pudlak
2013/4/22 Clark Gaebel
I don't have a copy of GHC HEAD handy, and don't have the time to set up the ecosystem myself to test this one bug.
Would someone else with a copy lying around mind testing it out for me?
Thanks, - Clark
On Monday, April 22, 2013, Joachim Breitner wrote:
Hi,
Am Montag, den 22.04.2013, 16:44 -0400 schrieb Clark Gaebel:
More interestingly, the problem goes away if I enable profiling. That's kind of worrisome.
this part sounds similar than the recently discussed problem with the ackermann function (http://hackage.haskell.org/trac/ghc/ticket/7850) – maybe your code is only allocating stacks and nothing else? In that case you can try with GHC HEAD and see if the problem is fixed.
Greetings, Joachim
-- Joachim "nomeata" Breitner Debian Developer nomeata@debian.org | ICQ# 74513189 | GPG-Keyid: 4743206C JID: nomeata@joachim-breitner.de | http://people.debian.org/~nomeata
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

I'm on 7.6.2, and it does. Oh no. - Clark On Tuesday, April 23, 2013, Tom Ellis wrote:
On Tue, Apr 23, 2013 at 09:36:04AM +0200, Petr Pudlák wrote:
I tested it on GHC 6.12.1, which wasn't affected by the recent "ackermann" bug, but still it leaks memory.
I tested it on GHC 7.4.1 and I don't see any space leak.
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org javascript:; http://www.haskell.org/mailman/listinfo/haskell-cafe

Did you file this as a bug? On Tue 23 Apr 2013 23:16:03 JST, Clark Gaebel wrote:
I'm on 7.6.2, and it does. Oh no.
- Clark
On Tuesday, April 23, 2013, Tom Ellis wrote:
On Tue, Apr 23, 2013 at 09:36:04AM +0200, Petr Pudlák wrote: > I tested it on GHC 6.12.1, which wasn't affected by the recent "ackermann" > bug, but still it leaks memory.
I tested it on GHC 7.4.1 and I don't see any space leak.
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org javascript:; http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

No I haven't.
- Clark
On Thu, Jul 18, 2013 at 10:07 PM, Niklas Hambüchen
Did you file this as a bug?
On Tue 23 Apr 2013 23:16:03 JST, Clark Gaebel wrote:
I'm on 7.6.2, and it does. Oh no.
- Clark
On Tuesday, April 23, 2013, Tom Ellis wrote:
On Tue, Apr 23, 2013 at 09:36:04AM +0200, Petr Pudlák wrote: > I tested it on GHC 6.12.1, which wasn't affected by the recent "ackermann" > bug, but still it leaks memory.
I tested it on GHC 7.4.1 and I don't see any space leak.
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org javascript:; http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Sounds like a Real Good Thing to do :) On Fri 19 Jul 2013 11:10:25 JST, Clark Gaebel wrote:
No I haven't.
- Clark
On Thu, Jul 18, 2013 at 10:07 PM, Niklas Hambüchen
wrote: Did you file this as a bug?
On Tue 23 Apr 2013 23:16:03 JST, Clark Gaebel wrote:
I'm on 7.6.2, and it does. Oh no.
- Clark
On Tuesday, April 23, 2013, Tom Ellis wrote:
On Tue, Apr 23, 2013 at 09:36:04AM +0200, Petr Pudlák wrote: > I tested it on GHC 6.12.1, which wasn't affected by the recent "ackermann" > bug, but still it leaks memory.
I tested it on GHC 7.4.1 and I don't see any space leak.
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org javascript:; http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Then I will. Going to double check on 7.6.3, first.
Thanks for bringing this back to my attention. I forgot about it. :P
Regards,
- Clark
On Thu, Jul 18, 2013 at 10:12 PM, Niklas Hambüchen
Sounds like a Real Good Thing to do :)
On Fri 19 Jul 2013 11:10:25 JST, Clark Gaebel wrote:
No I haven't.
- Clark
On Thu, Jul 18, 2013 at 10:07 PM, Niklas Hambüchen
wrote: Did you file this as a bug?
On Tue 23 Apr 2013 23:16:03 JST, Clark Gaebel wrote:
I'm on 7.6.2, and it does. Oh no.
- Clark
On Tuesday, April 23, 2013, Tom Ellis wrote:
On Tue, Apr 23, 2013 at 09:36:04AM +0200, Petr Pudlák wrote: > I tested it on GHC 6.12.1, which wasn't affected by the recent "ackermann" > bug, but still it leaks memory.
I tested it on GHC 7.4.1 and I don't see any space leak.
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org javascript:; http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

https://github.com/patperry/hs-monte-carlo/issues/9
On Thu, Jul 18, 2013 at 10:20 PM, Clark Gaebel
Then I will. Going to double check on 7.6.3, first.
Thanks for bringing this back to my attention. I forgot about it. :P
Regards, - Clark
On Thu, Jul 18, 2013 at 10:12 PM, Niklas Hambüchen
wrote: Sounds like a Real Good Thing to do :)
On Fri 19 Jul 2013 11:10:25 JST, Clark Gaebel wrote:
No I haven't.
- Clark
On Thu, Jul 18, 2013 at 10:07 PM, Niklas Hambüchen
wrote: Did you file this as a bug?
On Tue 23 Apr 2013 23:16:03 JST, Clark Gaebel wrote:
I'm on 7.6.2, and it does. Oh no.
- Clark
On Tuesday, April 23, 2013, Tom Ellis wrote:
On Tue, Apr 23, 2013 at 09:36:04AM +0200, Petr Pudlák wrote: > I tested it on GHC 6.12.1, which wasn't affected by the recent "ackermann" > bug, but still it leaks memory.
I tested it on GHC 7.4.1 and I don't see any space leak.
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org javascript:; http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
participants (5)
-
Clark Gaebel
-
Joachim Breitner
-
Niklas Hambüchen
-
Petr Pudlák
-
Tom Ellis