Hi,
When you're looking at the 'Properties' of a program or file, what is the difference between the programs 'Size' and its 'Size on Disk?' Why is the latter always larger than the former? This may be common knowledge, but I've never known the answer. In fact, I've never thought to ask the question 'til now. Can anyone explain it to me.
THAANSA3
-
Files are stored on the disk in what is called called clusters (a group of disk sectors). Size on disk refers to the amount of cluster allocation a file is taking up, compared to file size which is an actual byte count. The lowest cluster size for FAT32 is 1, so if the actual file only needs a small portion of the cluster, the size on disk for that file will reflect the entire cluster as being used. This is why when you check the properties tab of a file (using Microsoft Windows), you will usually see the size on disk size is larger than the file size. - Webopedia
-
There's also a difference based on the file standard for executables, the so-called PE format. A PE format executable contains several sections, including code, initialized variables, and tables for exported and imported functions. In the file itself, these sections are typically right next to one another, without much fill space between them (other than with respect to the cluster structure issue discussed by angad1608). However, in memory, these sections are typically loaded so that each new section starts on a 4k boundary, with the result that, if a particular section takes up significantly less than 4k of memory, the remainder will be padded up to the next 4k boundary. (I'm actually not sure if it's a 4k boundary or a 1k boundary, but in any event, there is an executable loading boundary condition that results in a loaded file taking up a lot more room in RAM than it took up on disk, even uncompressed).
The size of a program or file?
Discussion in 'Windows OS and Software' started by THAANSA3, Jul 27, 2008.