How to stop Gloss, requiring an increase in memory?

I use gloss to create an RTS game in Haskell, but I noticed that even a very simple program will take up more and more memory as it starts up. The following program, for example, will gradually increase memory usage (it will require ~ 0.025 MB per second).

module Main ( main ) where import Graphics.Gloss import Graphics.Gloss.Interface.IO.Game main = playIO (InWindow "glossmem" (500, 500) (0,0)) white 10 0 (\world -> return (translate (-250) 0 (text $ show world))) (\event -> (\world -> return world)) (\timePassed -> (\world -> return $ world + timePassed)) 

I tried to limit the heap size at runtime, but it just crashes the program when it reaches the limit. I am worried that this behavior will become a performance issue when I have a more complex world, is there a way to use shine so that it is not a problem? Or am I using the wrong tool to work?

+4
source share
1 answer

Thanks, I fixed this in gloss-1.7.7.1. It was a typical space leak caused by laziness in the code that controls frame synchronization for animation. Your sample program now works in a constant space.

+4
source

Source: https://habr.com/ru/post/1447295/


All Articles