I've noticed that each time I run the same file through GZipStream
the file size differs. When I look at the file through Windows explorer, the size
is different, but the Size on disk
is always the same. Is this expected behaviour.
Asked
Active
Viewed 202 times
1

poy
- 10,063
- 9
- 49
- 74
-
You mean size is always different (with each compression of the same file) or the 'size' and 'size on disk' are always different? If the latter then the output must be smaller than the 'block size' of the drive. – Grant Thomas Feb 23 '12 at 15:00
-
@Mr.Disappointment - The size is always different with each compression. – poy Feb 23 '12 at 15:45
1 Answers
1
Is your file small? Usually with smaller files the OS may add some padding to the file to make it fill a cluster/block so you'll notice the size may be slightly different. This is much more noticeable on smaller files than larger ones.
For an explanation on the difference between size and size on disk check this link out.
http://freewindowsvistatutorials.com/differencesBetweenFileSizeVsSizeOnDiskInWindows7VistaXP.php

Four_0h_Three
- 592
- 10
- 27
-
The wording of the question has be wondering whether the OP means 'size' is arbitrary for the same file when compressed and that the 'size on disk' observation is a red herring. – Grant Thomas Feb 23 '12 at 15:02
-
-
-
@YetAnotherSoftwareDeveloper: A few bytes actually... which I realize is nothing, but it still surprised me. I'm wondering what in the algorithm is changing from each instance. – poy Feb 24 '12 at 14:41