I would like to now how those instructions are allocating memory.
For example what if I got code:
x = new int[5];
y = new int[5];
If t
Each process has different segments associated which are divided among the process address space : 1) The text segment :: Where your code is placed 2) Stack Segment :: Process stack 3) Data Segment :: This is where memory by "new" is reserved. Besides that it also store initialized and uninitialized static data (bss etc).
So , whenever you call a new function (which i guess uses malloc internally , but the new class makes it much safer to handle memory) it allocates the specified number of bytes in the data segment. Ofcourse the address you print while running the program is virtual and needs to be translated to physical address..but that is not our headache and the OS Memory management unit does that for us.