Skip to content

Don’t reuse huge string in test to save 4 GB RAM at runtime #79

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

Merged
merged 1 commit into from
May 31, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions zlib/test/Test.hs
Original file line number Diff line number Diff line change
Expand Up @@ -288,12 +288,12 @@ test_exception = ioProperty $ do
Right{} -> counterexample "expected exception" False

test_compress_large_chunk :: Property
test_compress_large_chunk = GZip.decompress (GZip.compress xs) === xs
test_compress_large_chunk =
GZip.decompress (GZip.compress (BL.replicate len 0)) === BL.replicate len 0
where
len = case finiteBitSize (0 :: Int) of
64 -> (1 `shiftL` 32) + 1
_ -> 0 -- ignore it
xs = BL.fromStrict $ BS.replicate len 0

toStrict :: BL.ByteString -> BS.ByteString
#if MIN_VERSION_bytestring(0,10,0)
Expand Down
Loading