Renamed member 'Size' to 'AllocatedSize' in MemoryBlock and OwningMemoryBlock in order to provide a hint that the allocated size may be different than the requested size. Comments were added to clarify this point.
Updated the InMemoryBuffer in FileOutputBuffer.cpp to track the requested buffer size.
Recently, MemoryBlock was changed so that its 'Size' member holds the size that was requested with allocateMappedMemory instead of the size that was actually allocated by allocateMappedMemory. The allocated size is usually (much) larger than the requested size.
This caused a large waste of memory, as in 100s of MBs in my use case, because on Windows allocateMappedMemory returns memory with a granularity of 64kb (16 pages) and SectionMemoryManager previously assumed that the blocks were multiples of the page size (4kb) as it would be on Unix/Linux systems, in the worst case causing 60kb of wasted memory for each allocation on Windows.
Also see bug: https://bugs.llvm.org/show_bug.cgi?id=41690