Skip navigation.
 
mlRe: I'm losing my memory (GC & NSImageView)
FROM : Erik Buck
DATE : Sun Nov 04 16:51:43 2007

You haven't given us enough information to know for
sure what the problem is.

You obviously suspect that the garbage collector is
not running often enough, and you may be correct.  One
of the most famous drawbacks to automatic garbage
collection is the problem of knowing when it should
run.  In this case, I suspect grabage collection only
runs if control returns to the event loop.  Sliders
and other controls do not return to the event loop
until mouse up.

Try calling your slider's action with
performSelector:afterDelay: so that the event loop and
the garbage collector run.

In my case, one application produces real time
animation, and a pause to garbage collect at the wrong
time is disastrous.  On the flip side, if garbage is
not collected often enough, memory use grows
uncontrollably and eventually the system pauses
because of swapping.

The problem for me is always the "pause".  With manual
memory management, the best/correct trade-off can be
implemented in each case.

It is good that Apple has provided an opt-in garbage
collector.  Many types of application are well suited
to automatic garbage collection and  are not affected
by pauses.  Other applications can't tollerate it.

Related mailsAuthorDate
mlI'm losing my memory (GC & NSImageView) Stuart Rogers Nov 4, 16:10
mlRe: I'm losing my memory (GC & NSImageView) Erik Buck Nov 4, 16:51
mlRe: I'm losing my memory (GC & NSImageView) Bill Bumgarner Nov 4, 17:21
mlRe: I'm losing my memory (GC & NSImageView) Stuart Rogers Nov 4, 23:56
mlRe: I'm losing my memory (GC & NSImageView) Uli Kusterer Nov 5, 01:18
mlRe: I'm losing my memory (GC & NSImageView) Rob Keniger Nov 5, 05:15
mlRe: I'm losing my memory (GC & NSImageView) Bill Bumgarner Nov 5, 05:47
mlRe: I'm losing my memory (GC & NSImageView) Stuart Rogers Nov 5, 22:16