
Bulat Ziganshin wrote:
Hello Simon,
Tuesday, November 14, 2006, 1:19:45 PM, you wrote:
i still forget to ask: if my program is idle during long time, is GC will occur each 0.3 seconds or GHC is smart enough to check that no much memory was allocated after last GC?
You'll only get one GC. Or at least that's the theory: I remember seeing cases where one GC caused a finalizer to be created, which in turn triggered another idle GC (because the heap had changed), which in turn created a new finalizer, and so on. If you see something like this, we should investigate.
well, how about this scenario for GUI program: user thinks and GC occurs, then user performs some simple action (say, move cursor to another line) and thinks again. new GC will occur at this moment, right? and counting that in my program major GC could be up to several seconds, this may make program very unresponsive
well, i don't tried this, just imagined. may be better strategy for automatic GC invocation will be checking ratio of used memory/memory used after last GC and perform automatic GC, say, only when this ratio grows to value more than 1.2?
(yes, i know that autoGCing can be just turned off)
Yes, that's another strategy we could use. The main reason I added the idle GC was to catch deadlock in fact: deadlock can only be caught by a major GC, and many of the tests rely on catching deadlock. Of course, if the idle GC is inconvenient, then you should turn it off. Cheers, Simon