If you’re like me and you have a number of debugging tools (WinDBG, Sysinternals tools, etc) you more than likely have a locally cached copy of the publicly available symbols. This certainly helps speed things up as you don’t have to query the online Microsoft repository every time you use one of these tools, however the locally cached copy can grow to quite some size.
In this post I will show you how I reclaim some of that storage space by leveraging the builtin-in Windows compression feature, specifically targeting the symbols cache. My computer is configured to use the local path of C:\Symbols and as such my instructions make the assumption the symbols are stored here.
Let’s take a look at my symbols folder before any compression settings are configured –
As you can see right now I’m using 6.77GB of disk space to cache symbols files – that’s quite a lot! I think it’s time we shrunk these files down a bit and reclaimed some precious SSD capacity. If we click on the ‘Advanced’ button in our right-click context menu we get a new window which provides an option to compress the folder.
Now we can ‘OK’ our way back out of the menus, as we do this Windows will prompt us to pick whether to apply the change to just this folder or any subfolders and files within it. We will leave the setting on the default of all files and subfolders.
Depending on how large the symbols cache is this next step could take some time.
Once the compression task has completed we can look at the size on disk to see how much space has been reclaimed.
That’s a fantastic return! We’ve gone from 6.77GB stored on disk to only 3.95GB of stored data, quite a return especially when we are talking about solid state drives with their additional cost. Put another way this is nearly a 42% reduction in consumed space, Windows compression is definitely doing a good job. If you are storing symbols locally I strongly recommend you consider compressing the cache folder to reclaim space, the overhead of decompressing them for use is minimal and you shouldn’t notice when debugging.
If you are curious, you can of course do this via the command line using the COMPACT command which also provides a convenient output detailing the savings.
PS C:\Symbols> compact
New files added to this directory will be compressed.
0 : 0 = 1.0 to 1 C 1394OHCI.pdb
0 : 0 = 1.0 to 1 C abocomp.pdb
0 : 0 = 1.0 to 1 C Accessibility.pdb
0 : 0 = 1.0 to 1 C AcGenral.pdb
0 : 0 = 1.0 to 1 C AcLayers.pdb
Of 1612 files within 1 directories
1612 are compressed and 0 are not compressed.
2,074,654 total bytes of data are stored in 766,580 bytes.
The compression ratio is 2.7 to 1.
Here we see that the compression ratio is 2.7 to 1, not bad at all, the full compact command line syntax is shown below for easy reference.
PS C:\> compact /?
Displays or alters the compression of files on NTFS partitions.
COMPACT [/C | /U] [/S[:dir]] [/A] [/I] [/F] [/Q] [filename [...]]
/C Compresses the specified files. Directories will be marked so that files added afterward will be compressed.
/U Uncompresses the specified files. Directories will be marked so that files added afterward will not be compressed.
/S Performs the specified operation on files in the given directory and all subdirectories. Default "dir" is the current directory.
/A Displays files with the hidden or system attributes. These files are omitted by default.
/I Continues performing the specified operation even after errors have occurred. By default, COMPACT stops when an error is encountered.
/F Forces the compress operation on all specified files, even those which are already compressed. Already-compressed files are skipped by default.
/Q Reports only the most essential information.
filename Specifies a pattern, file, or directory.
Used without parameters, COMPACT displays the compression state of the current directory and any files it contains. You may use multiple filenames and wildcards. You must put spaces between multiple parameters.
Hopefully the above information is informative and useful to you, as always if you have any questions please feel free to leave them in the comments below or send me a message/tweet.