Re: Explicit calls to the garbage collector.

2012-05-07 Thread Johan Tibell
On Mon, May 7, 2012 at 7:00 AM, Christopher Done
 wrote:
> I would also be interested to know this. A web server is an example of
> a Haskell program that could force garbage collection at the end of
> every request reply, especially a multi-threaded server where the
> memory use is localized to threads. For long-running applications, a
> GC at this point would be nice.

In non-GCed language people often use an arena allocator in situations
like this. However, a semi-space collector (which is what we use) we
get that behavior for free. If your request is processed in less time
than the minor GC cycle, all your data will be dead by the time the GC
run and thus collecting it is free.

-- Johan

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: Explicit calls to the garbage collector.

2012-05-07 Thread Johan Tibell
Hi,

On Mon, May 7, 2012 at 6:33 AM, Jurriaan Hage  wrote:
> LS.
>
> I have a very memory intensive application. It seems that the timing of my 
> application
> depend very much on the precise setting of -H...M in the runtime system 
> (-H2000M
> seems to work best, computation time becomes a third of what I get when I 
> pass no
> -H option).  I conjecture that this good behaviour is the result of gc 
> happening at the right time.
> So I wondered: if I can one when is the right time, is it possible then to 
> trigger
> GC explicitly from within the Haskell code?

You have to be very careful when benchmarking programs in garbage
collected languages. If you set the nursery size high enough the GC
might never run during your benchmark, but in a real program a big
nursery might perform worse than a smaller one. For any small GC bound
benchmark you can typically get it to run much faster by setting -A to
some ridiculous high number.

-- Johan

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: Explicit calls to the garbage collector.

2012-05-07 Thread Joachim Breitner
Hi,

Am Montag, den 07.05.2012, 15:33 +0200 schrieb Jurriaan Hage:
> I have a very memory intensive application. It seems that the timing of my 
> application 
> depend very much on the precise setting of -H...M in the runtime system 
> (-H2000M 
> seems to work best, computation time becomes a third of what I get when I 
> pass no
> -H option).  I conjecture that this good behaviour is the result of gc 
> happening at the right time.
> So I wondered: if I can one when is the right time, is it possible then to 
> trigger
> GC explicitly from within the Haskell code? 

there is performGC:
http://hackage.haskell.org/packages/archive/base/latest/doc/html/System-Mem.html#v:performGC

Greetings,
Joachim

-- 
Joachim "nomeata" Breitner
  m...@joachim-breitner.de  |  nome...@debian.org  |  GPG: 0x4743206C
  xmpp: nome...@joachim-breitner.de | http://www.joachim-breitner.de/



signature.asc
Description: This is a digitally signed message part
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: Explicit calls to the garbage collector.

2012-05-07 Thread Christopher Done
I would also be interested to know this. A web server is an example of
a Haskell program that could force garbage collection at the end of
every request reply, especially a multi-threaded server where the
memory use is localized to threads. For long-running applications, a
GC at this point would be nice.

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Explicit calls to the garbage collector.

2012-05-07 Thread Jurriaan Hage
LS.

I have a very memory intensive application. It seems that the timing of my 
application 
depend very much on the precise setting of -H...M in the runtime system 
(-H2000M 
seems to work best, computation time becomes a third of what I get when I pass 
no
-H option).  I conjecture that this good behaviour is the result of gc 
happening at the right time.
So I wondered: if I can one when is the right time, is it possible then to 
trigger
GC explicitly from within the Haskell code? 

best,
Jur
 
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users