PE: Relation between SizeOfRawData and VirtualSize fields of the section header
<p>I see that for sections in image files the <code>VirtualSize</code> field is the total size of the section when loaded into memory, while the <code>SizeOfRawData</code> field is the size of the section's initialized data on disk.</p>

<p>While examining an <code>.idata</code> section, the <code>VirtualSize</code> field was set to 0x14, while the <code>SizeOfRawData</code> field was set to 0x400.</p>

<p>Why would the linker - in this case MinGW <code>ld</code> - make the file section so large, while the section when loaded into memory is only a fraction it's size?</p>

<p>Also, what is the purpose of the <code>VirtualSize</code> field? Why not always load the whole section, i.e. load the <code>SizeOfRawData</code> bytes?</p>

<p>I don't see a description or their relation in the official PE documentation.</p>