Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide functionality to delete temporary and cached files that do not affect core functionality #132509

Closed
TryerGit opened this issue Sep 7, 2021 · 5 comments

Comments

@TryerGit
Copy link

TryerGit commented Sep 7, 2021

Can some feature be provided that is able to restore VSCode's core functionality without breaking anything? In Windows OS, for instance, it is suggested to periodically delete the contents in %tmp% folder. In Google Chrome, there is a functionality to delete cache, cookies, and other browsing data. On my machine, the size of the C:\Users\AppData\Roaming\Code folder is an unpleasant 8.5 GB. This makes the footprint of VSCode almost like Visual Studio IDE itself if not more!

On attempting to see what exactly is taking up so much space, I did the following experiment.

On navigating to C:\Users\AppData\Roaming\Code and issuing command:

cmd /v /c "set zeropad=000,000,000,&for /f "delims=" %a in ('dir /ad /b') do @set bytes=!zeropad!000&(for /f "tokens=3" %b in ('dir /s "%a" 2^>NUL ^| find "File(s)"') do @set bytes=%b)& @for /f "tokens=1* delims=," %c in ('echo !bytes!') do @(set bytes=%c&@set bytes=000!bytes!&@set bytes=!bytes:~-3!& @set bytes=!zeropad!!bytes!&if "%d" NEQ "" set bytes=!bytes!,%d) & @echo !bytes:~-23! %a" | sort /R

from the command line (the above code sorts the directories in descending order of size: see https://stackoverflow.com/a/52266721) I obtain:

000,000,009,044,449,015 User
000,000,000,655,911 CachedExtensions
000,000,000,617 Local Storage
000,000,000,557,424 GPUCache
000,000,000,192 Backups
000,000,000,144 Code Cache
000,000,000,112,807 CachedConfigurations
000,000,000,104,205 logs
000,000,000,040 Crashpad
000,000,000,037,537,819 Cache
000,000,000,031,217,745 CachedData
000,000,000,019,032 Service Worker
000,000,000,011,386 Session Storage
000,000,000,008,706,157 CachedExtensionVSIXs
000,000,000,000 Dictionaries
000,000,000,000 blob_storage

which tells me that the User subdirectory is 9 GB in size. Navigating inside of this directory, I reissue the above command to obtain a breakup of what is taking up space within this subdirectory:

000,000,009,044,096,467 workspaceStorage
000,000,000,345,537 globalStorage
000,000,000,000 snippets

So, workspaceStorage takes up significant space. I navigate further within this directory and reissue the above command to obtain:

000,000,001,483,489,384 398036fa64df56be94f9c702dfcd24f8
000,000,000,810,635,236 c96d24390cf402159ec38450cc66558c
000,000,000,761,890,780 14e40990ff5a7901051f15d5c9befb35
000,000,000,737,558,221 d9cfc926ecf47805725842224a91f063
000,000,000,733,999,290 c6a3bc3dbd642f0c7bee59353b017616
000,000,000,733,532,246 76549cad3bebb6eddc9c4111b4baaac0
000,000,000,733,397,098 2ee136d9e4fcd665b165960496a60f11
000,000,000,733,196,386 9a9a955fedcc56e3287e26273a515eb9
000,000,000,732,135,530 f57c576ad81160bd223cbe1d47eac425
000,000,000,731,472,046 d45792cc2ee655156cd5f351ae4b86ab
000,000,000,730,579,053 ab5da3d8731e1999acaa4e89908c76ae
000,000,000,180,358 149f9491450820657c612a605914cac5
000,000,000,155,762 a8d3eaf21ce8e2838b854a4ac9f89094
000,000,000,139,396 d6c1a96d75e1f9b972ddc2dba1e70edd
000,000,000,131,286 71efe7a99521a8479f38e2ffca1f009b
000,000,000,131,206 0cae5d2b4332abf723b34a0c079b397e
000,000,000,123,082 4250dfe748d56041b2997caccca2810c
000,000,000,123,001 6cfbe6d198d48248042266e64c993fa7
000,000,000,090,226 070ed72a88d6fc7490d75f26af92352f
000,000,000,083,505,314 354d739845211228bd16d95b8adb986b
000,000,000,073,849 461a52c7f10560d72e1ac2f5a747afe6
000,000,000,025,345,924 48829c7ef0ea65af8ba86e7f026d627e
000,000,000,012,211,793 43871e50e65fee69034a4798b5f0fba2

What exactly are these folders and can they be safely deleted? Also, under /Code/ at the top level, there are multiple folders that have "cache" in their names. Can these be safely deleted by the user without breaking anything?

If this functionality is difficult to provide within VSCode, please specify in the documentation which folders can be safely deleted by the user that does not lead to breaking anything.

@gjsjohnmurray
Copy link
Contributor

See #32461

@TryerGit
Copy link
Author

TryerGit commented Sep 7, 2021

See #32461

Thanks John. On following that discussion thread, it did not appear to me what the resolution was. Some users(?) were suggesting that workspaceStorage should be placed locally in the user's actual project directory itself instead of under /AppData/Roaming

It was also not clear if the user can just delete all subfolders in this directory "workspaceStorage "

@gjsjohnmurray
Copy link
Contributor

It's still an open issue.

I think you can safely delete those subfolder if you don't mind losing state information that some of your extensions have persisted for workspaces you have worked in.

@TryerGit
Copy link
Author

TryerGit commented Sep 7, 2021

Great! Just deleted the subfolders and now the /Code/ folder is a more likeable 76 MB in size :-) Any thoughts on the other folders with "cache" in their names, John? Since the size is more manageable now, I am not overly concerned about them, but it would be good to know their utility as well. I am referring to folders "Cache", "CachedConfigurations", "CachedData", etc.

@lramos15
Copy link
Member

lramos15 commented Sep 7, 2021

Like many applications VS Code employs caching and storage to restore state and provide a faster experience. You will not lose any data by deleting these files unless you have unsaved changes. Deleting cached data will lead to a slower initial experience as the files are cached again

@lramos15 lramos15 closed this as completed Sep 7, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Oct 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants