6

On my work computer I've noticed that some icon-theme.cache files are very large. For example:

  1. /usr/share/icons/hicolor/icon-theme.cache: 120MB
  2. /usr/share/icons/gnome/icon-theme.cache: 113MB
  3. /usr/share/icons/pacifica/icon-theme.cache: 103MB
  4. /usr/share/icons/oxygen/icon-theme.cache: 94MB

etc. What could be the reason for this? For example, on my home computer, /usr/share/icons/hicolor/icon-theme.cache is only 24kB big, and others are even smaller than that.

Can I delete these files (will they auto-regenerate)? Or is there any other way to shrink them?

  • Could you post directly the output, I don't want to believe my eyes :). LANG=c ls -lh /usr/share/icons/*/icon-theme.cache – user.dz Dec 10 '16 at 11:40
  • @user.dz thanks for your answer. I've reinstalled my OS, so no more way for me to check this again. But I'll accept your answer. Btw, have you seen my replies to your comment on my bounty question? I think I didn't tag you correctly there, could you please have a look? – Томица Кораћ Dec 10 '16 at 11:53
2

Yeah, they are really so huge. Their generation is triggered separately by dpkg if there is any new file during installation of packages.

  1. You can remove them

    sudo rm /usr/share/icons/*/icon-theme.cache
    
  2. Then force regenerating them

    sudo update-icon-caches /usr/share/icons/*/
    

The system can work without cache, just little drop in GUI performance.

2

The icon theme cache contains an index of the image files contained in the directory, and can optionally include the corresponding uncompressed image data.

The rationale for including image data was that instead of opening and decoding each individual image file, the app would just memory map the cache file and access it directly.

The default used to be to include image data in the cache, but this was changed in mid 2014. The main reason for this was that the format used to store raw image data in the cache no longer matched what was used for displaying the images, so it was no longer offering zero copy access. Also, the improvements in CPU speeds over the years relative to hard disk speeds mean it is not obvious that avoiding the need to decompress data is a win when it means reading more data off disk.

So getting back to the original question: the reason the caches are smaller on your home system compared to your work system is most likely because the work system is running an older distribution release where the caches have been built to include image data. When the work system is upgraded, its cache sizes should shrink.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.