Reputation: 11
My current situation is the following: I am allocating t
bytes with malloc(t)
then I fill this memory with data (just to force the mapping from virtual to physical memory). The memory page size is 4kB.
Given this situation, I have the following questions:
1.) How much physical memory is used by this (I see the following options):
t
bytes no wasted memory (not even a partial memory page)t
B + at most 4kB (one memory page of waste it can be used within the same process).t
B + at most 4kB (one memory page of waste it cannot be used while the allocation exists)2.) Will this continous piece of virtual memory (one allocation) also be mapped to a continous piece of physical memory?
3.) If there is some waste, can I measure the exact memory footprint of my application? preferably from inside C++.
I should note, that currently my code runs on a ubuntu linux machine, but insights into other systems would still be welcome.
Upvotes: 1
Views: 73
Reputation: 753
Upvotes: 1