.Is there any way to stop .vs from growing

slipbits 16 Reputation points
2021-05-02T16:31:53.513+00:00

Visual Studio 16.9.4
Win6-64
My .vs folder has grown from 800MB to 1.2GB. Is there any way to stop this growth (and why is it happening)?

The total size of my C++ programs is 860KB. The .vs folder is about 1,395,348 times the total number of bytes in my entire source code. There are 50 files, header and source code, in my program. The .vs folder size seems excessive in comparison.

Developer technologies | Visual Studio | Other
0 comments No comments
{count} vote

5 answers

Sort by: Most helpful
  1. slipbits 16 Reputation points
    2021-05-02T20:25:26.07+00:00

    @Karen Payne MVP I will do what you suggest. I've looked a little closer at the nonsensical .vs, and found:

    .vs/HOAAnalysis/v16/ipch/AutoPCH/  
    

    Is where most (90%+) of the memory hides, and the the *.ipch is sole repository of this baggage in a series of directories (with strange names), with each directory containing a single file named <filename>.ipch. The <filenames> seem to al be *.cpp files of standalone *.h files in my project.

    I did the following:

    1. Closed VS.
    2. Deleted all the <strange folder name>s
    3. Started VS

    A single 52Mb <strange folder name>with a single 52Mb ipch file was created, named <my project name>.ipch.

    This all means that VS is graciously creating 52Mb+ files to enhance my working experience. I can't tell you how grateful I am, and how soon I will be adding a single 4Tb HDD dedicated to a single 800Kb project. The consumer wold is so much better off with these 50Mb files that I just, absolutely just, don't know and to give them enough warm and cuddlies. Oh well.

    Thanks karen.

    1 person found this answer helpful.

  2. Karen Payne MVP 35,586 Reputation points Volunteer Moderator
    2021-05-02T17:07:45.283+00:00

    Try closing Visual Studio, delete the .vs folder will will clean up temporary caches and several other items. The thought is there is bloat in the caches. I'm working with 40+ projects in a solution with less than 300mb in the .vs folder.

    If worried about removing the folder simply rename it, Visual Studio will recreate it the folder and contents fresh.


  3. Viorel 122.6K Reputation points
    2021-05-02T17:31:17.897+00:00

    It probably contains valuable data required for “precompiled headers” convenient feature. You can try disabling it — see Project Properties, C/C++, Precompiled Headers, Precompiled Header, and select “Not Using Precompiled Headers” (for all projects, configurations, platforms). However, the compilation time will probably degrade.

    0 comments No comments

  4. slipbits 16 Reputation points
    2021-05-02T20:00:34.723+00:00

    @Fulvio Cavarretta I don't use precompiled headers, and if I did it wouldn't explain the explosive size (1.2GB) or the growth (800Mb when I first looked, 1.2GGb a week or two later). It's hard to see that I have 1.2Gb of valuable data for a 800Kb project.

    0 comments No comments

  5. John Bruder <johnb@sisconet.com> 0 Reputation points
    2024-08-21T19:29:58.5966667+00:00

    This link:

    https://learn.microsoft.com/en-us/visualstudio/ide/reference/options-text-editor-c-cpp-advanced?view=vs-2022

    explains houw you can use the "Always Use Fallback Location" option in Visual Studio to put the files in a different directory (e.g. C:\temp). I found this option very convenient to reduce your development directoy size.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.