Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data.Map memory leaks after an inline #1074

Open
nikivazou opened this issue Nov 29, 2024 · 2 comments
Open

Data.Map memory leaks after an inline #1074

nikivazou opened this issue Nov 29, 2024 · 2 comments

Comments

@nikivazou
Copy link

Hey, my program returns within seconds with the below function, but runs forever when the first occurrence of f1' is replaced with the equivalent f1 m.

import qualified Data.Map as M

combine :: (Ord k) => (M.Map k v -> [(k, v)]) -> (M.Map k v -> [(k, v)])
        -> (M.Map k v -> [(k, v)])
combine f1 f2 m =
  let f1' = f1 m
      f2' = f2 (m `M.union` M.fromList f1') -- program does not terminate when f1' is replace with f1 m 
  in f1' ++ f2'

Not sure if this expected or known, but I cannot explain it, so reporting it in case it's worth further investigation.

I am using containers-0.7 and ghc-9.10.1.

(@pacastega)

@meooow25
Copy link
Contributor

Hi, that is certainly strange, but it's hard to figure something out without knowing the inputs to the function. Do you have a reproducible example?

@nikivazou
Copy link
Author

Let's see if we can reproduce this behavior in a small file.
If not, if you are interested, we could give you access to the complete project that has this behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants