On 03/15/10 06:52 PM, Danek Duvall wrote:
Shawn Walker wrote:
On 03/15/10 05:44 PM, Danek Duvall wrote:
Shawn Walker wrote:
http://cr.opensolaris.org/~swalker/pkg-mem/
So the previous behaviour in this area was actually a bug. The
__get_catalog method was intended to always bypass the normal caching
mechanism so the callers like image.get_last_modified() could get the
actual on-disk last modification date without affecting or using any
cached information. The comment for the get_last_modified() states
this already.
Though as far as I can tell, get_last_modified() did get uncached data, but
essentially forced the data to be cached, or re-cached unnecessarily. So
this doesn't change the correctness of get_last_modified(), just the
consequent, memory-hogging behavior.
Right, sorry if I worded that poorly.
The change was related to the memory usage reduction in that it was
causing any code that executed after a call to get_last_modified() to
have to reload catalog data again when it didn't need to.
Wait, isn't that the new behavior, now that get_last_modified() doesn't
call a method that caches the catalog?
Ah, I understand what you mean. The difference is that a
get_last_modified() call only triggers a call to load the catalog.attrs
part of a catalog since that's what contains the last-modified time. It
won't load catalog.base.C, etc. which contains actual package data.
On a SPARC T5120, the time needed to actually load the catalog.attrs
file is < 0.1s real. So there's little benefit to caching this for
get_last_modified() calls.
Since the get_last_modified() call was causing the existing cache entry
to be overwritten, any subsequent callers of get_catalog() would not
only trigger a load of the catalog.attrs file and any other catalog data
they needed again, but it also increased memory usage since any
references to the previously cached catalog would still be there
preventing garbage collection.
Cheers,
--
Shawn Walker
_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss