Pages

Wednesday 3 November 2010

How to disable Google Chrome's cache

I like many things about Google Chrome, such as its speed, tab handling and unified search box. But one very annoying feature is the lack of control over the content cache. Yes, you can clear it out using the Options, but there's no obvious way to set the size or disable it.

Why turn off the cache? Well, my Windows 7 PC has been suffering from occasional freezes and stutters for a while, always accompanied by a solidly-lit hard disk light. Chrome always seemed to be involved, and looking at Windows 7's Resource Monitor it was clear that my current anti-virus program (MS Security Essentials) was busy thrashing its way through scanning the cache every time Chrome launched or added files to it. Using the info in a thread on Google's support forums, I found the cache to be almost 1GB in size. (It's located in %userprofile%\Local Settings\Application Data\Google\Chrome\User Data\Default). There are actually two cache folders, Cache and Media Cache.


It turns out there are two command-line switches that can set the cache size. Find the Chrome program icon in the All Programs menu, right click it and choose Properties. In the Target box, add --disk-cache-size=1 --media-cache-size=1 to the end of the command (after ...chrome.exe). 


After doing this, click Tools then Options, go to Under the hood, click Clear Browsing Data, uncheck all the items except Empty the cache, then click Clear browsing data. This clears the cache, and the new parameters prevent it growing again - after several days' use, my cache is only about 20MB.




The benefit was immediate and noticeable: the disk thrashing has now gone, and Chrome freezes less frequently (previously, it would often freeze when the status bar was saying 'Waiting for cache...'). In these days of fast broadband, I really can't see the need for huge content caches.


UPDATE 6/2/11: Seems like my freezing problem went deeper than just Google's cache, and even less likely for the average user to spot - see my newer post about dodgy Sata cables

21 comments:

  1. I've also had problems with Chrome freezing frequently, although I usually use it in my linux/ubuntu 10.04 OS, rather than windows. I deleted all google chrome 'cache' on the hard drive and haven't had any freezes since.

    One question: what's the difference between 'cache' and 'media cache' and do you recommend deleting both?

    ReplyDelete
  2. Hi Rob - Not sure of the exact technical details, but as they are both just caches intended to speed up performance (!), can't see any reason why both can't be cleared. I believe the media cache is related to streaming video files.

    ReplyDelete
  3. Dude! This worked!!! So happy!

    ReplyDelete
  4. --disk-cache-dir="z:\" --media-cache-dir="z:\"

    Use this instead, where z:\ is not a valid disk drive, therefore chrome will use a nonexistent drive path effectively disabling caching.

    ReplyDelete
  5. I have tried to add --disk-cache-size=1 --media-cache-size=1 as indicated (cut and paste so no typos) but it keeps telling me that the specified target box is not a valid...

    ReplyDelete
  6. Hi Nico62 - not sure what the problem is, but make sure there is a space between the last 'e' of chrome.exe and the first dash of the parameters. The entire string looks like this: C:\Users\[yourusername]\AppData\Local\Google\Chrome\Application\chrome.exe --disk-cache-size=1 --media-cache-size=1

    ReplyDelete
    Replies
    1. Mr. Taylor: Appreciate this thread and your solution greatly! Have tried, as others have to insert the switches into the
      "Target" path. Mine points directly to "C:\Program Files\Google\Chrome\chrome.exe" rahter than my "AppData" path. Your input would be greatly appreciated. FYI - Using Chrome v. 39.0.2171.95 m.

      Thanks again.

      Robert

      Delete
    2. Mr. Taylor: I hope you're still monitoring this thread. I found you while searching for a solution to the same issue with the "Waiting for cache..." message. I too am having the same issue with getting the "Target" field in the properties dialog box to accept the switches! Same 'error', "...specified target...". Am continuing to try various syntax and researching alternate methods for a solution to this irritating behavior in Chrome.

      Kindest regards,

      Robert Goltz

      Delete
  7. Paste that info AFTER the quotation marks.

    ReplyDelete
  8. I was having the same problem and it was getting very frustrating. This fixed it. Thanks Kelvyn. You are a savior.

    ReplyDelete
  9. Thank you this fix worked --disk-cache-dir="z:\" --media-cache-dir="z:\"

    ReplyDelete
  10. This doesn't actually work. Get "not valid" error. Tried the path both with the space as suggested by the OP as well as without. As well as with the double quotation marks after the "e" in exe and without. Same result. ERROR.

    ReplyDelete
    Replies
    1. what you're doing is adding 'switches' that modify the command being launched. Leave the quotation marks alone as they are and add the two switches after the ending quotation mark. There should only be two, one at each end of the original entry.

      Delete
  11. I have tried both strings... was able to get them to "take" but I still have the problem. This exe file is what seem to be the problem:

    zpdxjuowhw.exe*32

    I found this via Task Manager/Processes. at any one time I can have from 1 or 2 strings "processing " to up to 30-40. It is just thrashing my hard drive and slowing down the PC. Interestingly enough, I have tried the following solutions.

    Completely uninstalled Chrome and then went back to task manager and shredded the file. Upon restart, problem gone. But as soon as I connected to the internet again - still with Chrome uninstalled, it came back. So I disconnected from the net, shredded again, and problem is gone... but, as soon as I connected again it came right back.

    Then I reinstalled and tried both strings above and no solution. Any thoughts?

    ReplyDelete
  12. when i did it, a thing popped up that said that what i typed was invalid even when i did copy and paste

    ReplyDelete
    Replies
    1. Did you leave a space after the quotation marks? That worked for me. Not sure if it has sorted the cache problem out yet as only just done it, but it took the string after leaving a space after chrome.exe"

      Delete
  13. I too have found this to be a real pain. Every time I start Chrome (Win7 64 + Chrome 40.xxxx) I sit back while "waiting for cache" does it's thing. Yes I can manually clear the cache on exit BUT why should this be necessary. I've tried the switches but somehow Chrome seems to work around them and re-establishes the cache. I've installed Click&Clean but still no joy.

    I think that the solution is to try another browser and rob poor old Google of my surfing data! Thanks for this blog ... I tried it all!

    ReplyDelete
  14. Hi guys. I'm not at a PC so I can't check this, but isn't there another type of cache; like a read ahead cache to load pages linked to the one you're browsing? That would be a setting that could be disabled. Personally, I also suspect the Windows cache manager could be contributing to my problem much like Chrome. Win 7 x64. Good hunting!

    ReplyDelete
  15. Love this. I did this with no prob. Worked like a champ and is
    running like new. When adding this op, be sure to get rid of the "quotation" mark
    after the string. I have also found that different programs can cause asimilar problems.
    "Free Antivirus" shit, especially when its soon to expire will screw with you. And it can be ruthless. Flash players can ape the same symptoms as well....delete them and start over. This
    post was a good send. Works and put a smile on my face. Thanks so much from Digger, Cleveland,OH

    ReplyDelete
  16. I wish that chrome just made it possible to say "disable caching of objects really freaking huge" ; problem is, if it has such a setting, 4k Youtube content via http live streaming chunks it up into pieces smaller than the 'really freaking huge' size.
    Then i could watch 4k videos, which when rescaled to 1080p on my 1080p monitor, produces exceedingly crisp video without majorly noticeable compression artifacting, as exists on youtube's 1080p videos(not enough bitrate) ... without killing my SSD to the tune of 75 megbytes-per-second of both Chrome, and XFSs own internal metadata processes, writing and deleting craptons of files in cache to do this.

    ReplyDelete