[Haskell-cafe] Allocating enormous amounts of memory and
wondering why
Bulat Ziganshin
bulat.ziganshin at gmail.com
Mon Jul 9 01:29:01 EDT 2007
Hello Jefferson,
Monday, July 9, 2007, 1:26:18 AM, you wrote:
> I'm using the Data.AltBinary package to read in a list of 4.8 million
> floats and 1.6 million ints.
> coordinates <- get pointsH :: IO [Float]
> galaxies <- get pointsH :: IO [Int]
thank you for discovering bug in the library! next version will
include thought-reading module which will be able to find how
much values to actually want to read. as a temporary workaround, you
can use the following code
> coordinates <- getList pointsH (48*10^5) :: IO [Float]
> galaxies <- getList pointsH (16*10^5) :: IO [Int]
> Doing so caused the memory footprint to blow up to more than 2gb,
it was because 'get' reads number of items in the list from input
stream itself ;)
--
Best regards,
Bulat mailto:Bulat.Ziganshin at gmail.com
More information about the Haskell-Cafe
mailing list