beforeGarbageCollection

Leandro Lucarella luca at llucax.com.ar
Thu Jun 17 10:47:43 PDT 2010


Andrei Alexandrescu, el 17 de junio a las 09:15 me escribiste:
> >>Any thoughts, please share.
> >
> >Hum, cleaning up caches will reduce the memory used, but not using
> >a cache will too.
> 
> I agree :o).
> 
> >If you use a cache, it's probably because you need one to improve
> >performance, so it may have an adverse effect on performance if
> >you clear caches at every collection cycle. Are collections only
> >done when you're low on memory? I doubt it. It'd be more useful I
> >think to have a callback for when you're actually low on physical
> >RAM (because swapping caches to disk through virtual memory is
> >quite unproductive).
> 
> I think currently collections occur only when you're low on memory,

It does, but when is low on it's own pools of memory, not when the
physical memory is low, as Michel suggested. I agree with Michel, it's
pointless to clear some cache because a collection was triggered, it's
only useful only when the physical memory is exhausted, but even then,
you can't assume much from it. For example Linux makes a heavy use of
physical memory for disk cache, so even when you might have little
physical memory available, a lot can be used by disk cache, and would
you really want you give up your own cache for the OS disk cache? I'm
not so sure...

It's a really delicate issue...

-- 
Leandro Lucarella (AKA luca)                     http://llucax.com.ar/
----------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------
Peperino nos enseña que debemos ofrendirnos con ofrendas de vino si
queremos obtener la recompensa de la parte del medio del vacío.
	-- Peperino Pómoro


More information about the Digitalmars-d mailing list