Hi,
When a data space is created, physical memory is reserved and cannot be used by other processes until the data space is destructed. I wonder if it would be a possible situation where physical memory may get wasted. For example, an application may first allocate a huge chunk of memory (through malloc, which will eventually lead to the creation of one or more data spaces), but only touch a small portion of it throughout the entire execution. Another example would be to have a large binary where a significant portion of the binary are not actually executed. Thus, reserving physical memory for these instruction when a program is loaded may not be good, especially in a resource-constrained environment.
Does anybody know whether Linux has a similar mechanism (i.e. reserve a chunk of physical memory for a virtual memory region before the first access to this region)? If not, what are the pros and cons of these two strategies?
Thank you.
Best,
Chen