The Notebook Review forums were hosted by TechTarget, who shut down them down on January 31, 2022. This static read-only archive was pulled by NBR forum users between January 20 and January 31, 2022, in an effort to make sure that the valuable technical information that had been posted on the forums is preserved. For current discussions, many NBR forum users moved over to NotebookTalk.net after the shutdown.
Problems? See this thread at archive.org.

    The size of a program or file?

    Discussion in 'Windows OS and Software' started by THAANSA3, Jul 27, 2008.

  1. THAANSA3

    THAANSA3 Exit Stage Left

    Reputations:
    171
    Messages:
    1,885
    Likes Received:
    0
    Trophy Points:
    55
    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
     
  2. Andy

    Andy Notebook Prophet

    Reputations:
    2,133
    Messages:
    6,399
    Likes Received:
    1
    Trophy Points:
    206
    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

    Default Cluster Size for FAT and NTFS
     
  3. Shyster1

    Shyster1 Notebook Nobel Laureate

    Reputations:
    6,926
    Messages:
    8,178
    Likes Received:
    0
    Trophy Points:
    205
    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).