-
Notifications
You must be signed in to change notification settings - Fork 92
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
handleToFd leaks memory #4
Comments
I can't reproduce this. I see variable but bounded virtual memory size for this program, never exceeding about 60M, with resident size around half that. |
What version of On Tue, Jul 29, 2014 at 9:24 PM, rwbarton notifications@github.com wrote:
|
@pudlak How are you compiling the program? Are you passing in any RTS options? |
@snoyberg I don't pass any optimization or RTS options, but anyway it seems it doesn't really matter. Here is a cabal setup that produces such an executable:
I always compile and run it inside a schroot, IDK if this could somehow contribute to the problem. I tested it in both Wheezy (GHC 7.4.1, unix-2.5.0.1) and Squeeze schroot (GHC 7.6.3 and unix-2.[6,7].0.1), the problem manifests in all these setups. |
I'm still unable to repro. Can you try without schroot and see if it still occurs? |
Can you reproduce the problem with a Dockerfile or vagrant script? Given the trouble others are having reproducing this, if we can get a repeatable build setup that illustrates the bug via VM/container that would be helpful here. |
@gregorycollins I'll try to do that. @snoyberg So far I'm unable to reproduce it outside schroot as well. |
It can be reproduced in a docker image my coworker (@nh2) created: nh2docker/ganeti-ubuntu1404-code-syshs |
I can reproduce this using the docker image. |
@nomeata any idea on how to fix this? |
This seems to be some issue with broken locales related to GHC Trac #7695 and #10298. I can reproduce it on an ordinary system after |
Nice find. It doesn't leak very quickly, but this definitely triggers the issue on my machine. |
OK, the cause is rather simple. Compare the eventual implementation of
to that of
so clearly The reason the (large) leak does not normally appear is just that GHC implements UTF-8 encoding itself, without using iconv. Any locale for which GHC uses iconv produces the same behavior, not just non-existent locales. It looks like this should be fixable by just copying the relevant parts of |
Tried to reproduce it in 2022... the only GHC I could reproduce it with is 8.0.2. Next unix release won't support 8.0.2 or earlier, so it appears this issue is resolved. |
On unix-2.6.0.1 with GHC 7.6.3 the following program leaks memory very fast:
This is only due to
handleToFd
. Opening a file directly usingopenFd
doesn't leak.The text was updated successfully, but these errors were encountered: