[Haskell-cafe] How to Kill Haskell

Eric Crockett ecrockett0 at gmail.com
Tue Nov 18 14:41:14 UTC 2014


There's some information here 
<http://stackoverflow.com/questions/18430748/killing-a-haskell-binary>, but 
that doesn't explain why ^c works sometimes and not others, nor if that is 
indeed the proper way to terminate a program.

On Tuesday, November 18, 2014 9:38:43 AM UTC-5, Eric Crockett wrote:
>
> For the purposes of profiling a partially evaluated program, I'm 
> interested in knowing the best way to terminate a GHC program. This is 
> useful for profiling programs that take a long time to run, possibly as 
> long as forever. It appears that *if* the program can be terminated with a 
> single ^c, then profiling information is written to output. Sometimes, a 
> single ^c doesn't kill the program, at not before I get impatient and hit 
> ^c again. Usually two ^c will kill the program, but then no profiling data 
> is written to output. As a simple example,
>
> Main.hs
> fib n = fib (n - 1) + fib (n - 2)
> main = print $ fib 100
>
> Compiling with -prof and running with +RTS -p, I can kill this program 
> with a *single* ^c in the first approximately 10 seconds of execution, but 
> after that only two ^c will do the job. Looking at my resources, this 
> change appears to coincide with the program using all of my physical memory 
> and moving to swap space, however that could also be coincidental.
>
> Why does ^c work sometimes, but not other times for the same program? What 
> is the easiest way to ensure that profiling data will get printed when the 
> program does not terminate on its own?
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20141118/33ebe197/attachment.html>


More information about the Haskell-Cafe mailing list