[GHC] #12664: System.Environment.withArgs and friends leak memory
GHC
ghc-devs at haskell.org
Wed Oct 5 11:06:53 UTC 2016
#12664: System.Environment.withArgs and friends leak memory
-------------------------------------+-------------------------------------
Reporter: simonmar | Owner:
Type: bug | Status: new
Priority: normal | Milestone: 8.0.2
Component: | Version: 8.0.1
libraries/base |
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: None/Unknown
Unknown/Multiple |
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
`ArgvLeak.hs`:
{{{
import System.Environment
main :: IO ()
main = withArgs ["a","b","c"] $ return ()
}}}
repro:
{{{
> ghc ArgvLeak.hs
[1 of 1] Compiling Main ( ArgvLeak.hs, ArgvLeak.o )
Linking ArgvLeak ...
> valgrind --leak-check=full ./ArgvLeak
==27227== Memcheck, a memory error detector
==27227== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==27227== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright
info
==27227== Command: ./ArgvLeak
==27227==
==27227== Warning: set address range perms: large range [0x200000000,
0x600100000) (noaccess)
==27227==
==27227== HEAP SUMMARY:
==27227== in use at exit: 107 bytes in 9 blocks
==27227== total heap usage: 62 allocs, 53 frees, 60,175 bytes allocated
==27227==
==27227== 55 (40 direct, 15 indirect) bytes in 1 blocks are definitely
lost in loss record 6 of 6
==27227== at 0x4C2FB55: calloc (in /usr/lib/valgrind
/vgpreload_memcheck-amd64-linux.so)
==27227== by 0x470057: stgCallocBytes (RtsUtils.c:107)
==27227== by 0x4652C1: copyArgv (RtsFlags.c:1811)
==27227== by 0x465FAE: setProgArgv (RtsFlags.c:1877)
==27227== by 0x41CC4A: base_SystemziEnvironment_zdLr7BcsetProgArgv_info
(in /home/smarlow/scratch/ArgvLeak)
==27227==
==27227== LEAK SUMMARY:
==27227== definitely lost: 40 bytes in 1 blocks
==27227== indirectly lost: 15 bytes in 4 blocks
==27227== possibly lost: 0 bytes in 0 blocks
==27227== still reachable: 52 bytes in 4 blocks
==27227== suppressed: 0 bytes in 0 blocks
==27227== Reachable blocks (those to which a pointer was found) are not
shown.
==27227== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==27227==
==27227== For counts of detected and suppressed errors, rerun with: -v
==27227== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12664>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list