I recently got to know an integer takes 4 bytes from the memory.
First ran this code, and measured the memory usage:
int main()
{
int *pointer;
In addition to the alignment and overhead issues mentioned in the other questions, this may be due to the way the C++ runtime requests process memory allocations from the OS.
When the process's data section fills up, the runtime has to get more memory allocated to the process. It might not do this in equal-sized chunks. A possible strategy is that each time it requests memory, it increases the amount that it request (maybe doubling the heap size each time). This strategy keeps the memory allocation small for programs that don't use much memory, but reduces the number of times that a large application has to request new allocations.
Try running your program under strace and look for calls to brk, and note how large the request is each time.