2

Profiling options aren't working with gloss, even though gloss was installed with library profiling enabled in ~/.cabal/config,

Example: Test.hs

import Graphics.Gloss
main = display (InWindow "test" (800, 600) (200, 200)) black blank

Compiling and running:

$ ghc Test.hs
[1 of 1] Compiling Test             ( Test.hs, Test.o )
Linking Test ...
$ ./Test +RTS -s

I then close the window with window's x button, but there isn't any gc output.

If I change Test.hs to main = print "test" and repeat the steps, it outputs some garbage collection related info, which is what should be happening.

mcjohnalds45
  • 667
  • 1
  • 8
  • 16
  • When the main glut window closes, it exits the entire program. You can set the [`actionOnWindowClose`](http://hackage.haskell.org/package/GLUT-2.2.2.0/docs/Graphics-UI-GLUT-Begin.html) variable, but that requires editing the source code of gloss. – user2407038 Jul 09 '14 at 15:26

1 Answers1

0

When profiling with Graphics.Gloss, you will need to explicitly handle the end of the program in your code. You might want to hardcode a timeout for the animation, or catch some keyboard input and manually end the program (using something as simple as unsafePerformIO exitSuccess).

The actionOnwindowClose seems to be on the wishlist of the gloss devs, but is not working at the moment (https://github.com/benl23x5/gloss/blob/b41f867ffb6c05a40f778a29f99933b603c11a31/gloss/Graphics/Gloss/Internals/Interface/Backend/GLUT.hs#L61)