[ccache] Increase in cache size on every run

Joel Rosdahl joel at rosdahl.net
Fri Aug 28 14:59:48 UTC 2020


Hi Vijay,

On Fri, 28 Aug 2020 at 13:17, Vijay Tandeker <vijayt at tejasnetworks.com> wrote:
> Every night I do the compilation. I don't know but whenever I do the
> compilation, cache size increases by few GBs (sometimes by few MBs).

That sounds perfectly normal for a build that generates parts of its source
code with volatile things like timestamps or usage of __DATE__ in the source
code, etc.

> And every after 10-14 days, it hits the max and I need to again clean it
> using -C option.

No, you don't need to use -C since ccache performs automatic cleanup (see
https://ccache.dev/manual/3.7.11.html#_automatic_cleanup).

> My understanding of ccache is:
> 1) in case of HIT, don't add anything. It should not increase the cache size.

Correct.

> 2) in case of MISS, if no entry is present, add new object file in the cache.
> It should increase the "cache size" by size_of_object_file.

Correct.

> 3) in case of MISS, If old entry is present, delete the old object file and
> add new object file. It should increase (or decrease) the cache size by
> (size_of_new_entry - size_of_old_entry). [...] ld entry should get replaced
> by new entry and should not consume space.

No, that's not how ccache works. A new entry (due to a cache miss) does not
replace a previous entry. See
https://ccache.dev/manual/3.7.11.html#_how_ccache_works for details.

By the way, you asked me more or less the same question in private mail more
than two years ago (2018-02-21, subject "query on ccache miss"). See that
conversation for further information.

Regards,
Joel



More information about the ccache mailing list