Closed luochen1990 closed 5 years ago
collect
was rewritten in QuickCheck 2.12. Could you try this on the latest version of QuickCheck (2.12.6.1) and see if you run into the same problem?
@nick8325 Thanks for your suggestion, but I'm using stack to install QuickCheck, and the latest version on stackage nightly is still 2.11.3 , should we update it on stackage?
You can tell stack to install a different version of quickcheck by adding to stack.yaml
:
extra-deps:
- "QuickCheck-2.12.6.1"
@Lysxia Thanks for your suggestion, I tried it and stack will throw the following error in this case:
Configuring hspec-core-2.5.5...
Preprocessing library for hspec-core-2.5.5..
Building library for hspec-core-2.5.5..
[ 1 of 27] Compiling Control.Concurrent.Async ( vendor\Control\Concurrent\Async.hs, .stack-work\dist\e626a42b\build\Control\Concurrent\Async.o )
[ 2 of 27] Compiling Data.Algorithm.Diff ( vendor\Data\Algorithm\Diff.hs, .stack-work\dist\e626a42b\build\Data\Algorithm\Diff.o )
[ 3 of 27] Compiling Paths_hspec_core ( .stack-work\dist\e626a42b\build\autogen\Paths_hspec_core.hs, .stack-work\dist\e626a42b\build\Paths_hspec_core.o )
[ 4 of 27] Compiling Test.Hspec.Core.Clock ( src\Test\Hspec\Core\Clock.hs, .stack-work\dist\e626a42b\build\Test\Hspec\Core\Clock.o )
[ 5 of 27] Compiling Test.Hspec.Core.Compat ( src\Test\Hspec\Core\Compat.hs, .stack-work\dist\e626a42b\build\Test\Hspec\Core\Compat.o )
[ 6 of 27] Compiling Test.Hspec.Core.Example.Location ( src\Test\Hspec\Core\Example\Location.hs, .stack-work\dist\e626a42b\build\Test\Hspec\Core\Example\Location.o )
[ 7 of 27] Compiling Test.Hspec.Core.Formatters.Diff ( src\Test\Hspec\Core\Formatters\Diff.hs, .stack-work\dist\e626a42b\build\Test\Hspec\Core\Formatters\Diff.o )
[ 8 of 27] Compiling Test.Hspec.Core.Formatters.Free ( src\Test\Hspec\Core\Formatters\Free.hs, .stack-work\dist\e626a42b\build\Test\Hspec\Core\Formatters\Free.o )
[ 9 of 27] Compiling Test.Hspec.Core.Timer ( src\Test\Hspec\Core\Timer.hs, .stack-work\dist\e626a42b\build\Test\Hspec\Core\Timer.o )
[10 of 27] Compiling Test.Hspec.Core.Util ( src\Test\Hspec\Core\Util.hs, .stack-work\dist\e626a42b\build\Test\Hspec\Core\Util.o )
[11 of 27] Compiling Test.Hspec.Core.QuickCheckUtil ( src\Test\Hspec\Core\QuickCheckUtil.hs, .stack-work\dist\e626a42b\build\Test\Hspec\Core\QuickCheckUtil.o )
C:\dev\msys2\tmp\stack8300\hspec-core-2.5.5\src\Test\Hspec\Core\QuickCheckUtil.hs:23:40: error:
Module ‘Test.QuickCheck.Test’ does not export ‘formatLabel’
|
23 | import Test.QuickCheck.Test (formatLabel)
| ^^^^^^^^^^^
I think this is because the package hspec
dependents on the function formatLabel
which is removed from the new version.
I find this PR of hspec, I will update my hspec and try again.
And I also found that the package version of both hspec & QuickCheck is updated in today's nightly snapshot on stackage.
checked on latest version and it is fixed, closing this issue
When I'm using
collect
in my test code, I find that the memory of my PC grows slow when the progress is far from complete, and suddenly grows very fast when the progress is close to complete (such as9999876/10000000
), and my 8GB memory is not enough for this process, so it failed with the following message:And when I remove the
collect
part, it works well without using lot of memory.I'm using stack with
resolver: lts-12.22
, following is the version info about QuickCheck:I can reproduce this problem on both Windows 10 and Ubuntu 18.04, following is my code to reproduce the problem:
I'm running the test via
stack test --test-arguments "-a 10000000 --match arith"
Since I'm collecting on a Bool, which has only 2 possible values, I don't think so many memory is necessary. I think there is a "memory leak" here for
collect
, I'm not sure whether other function such asclassify
andlabel
will have the same problem yet.