Re: Memory allocations in linux for processes

2013-03-20 Thread Mulyadi Santosa
On 3/19/13, Niroj Pokhrel nirojpokh...@gmail.com wrote: Hi Mulyadi . Thank you very much But I still have a minor confusion . All I ran was this short program #includestdio.h int main() { while(1) { } return 0; } well, before your program is loaded,

Re: Memory allocations in linux for processes

2013-03-19 Thread Mulyadi Santosa
Hi Niroj Please see inlined answer below... On Mon, Mar 18, 2013 at 5:28 PM, Niroj Pokhrel nirojpokh...@gmail.com wrote: Hi all, As I have read, whenever we execute a program, the memory is allocated in different sections viz stack, text and data segment. Yup, that is correct But,

Re: Memory allocations in linux for processes

2013-03-19 Thread Niroj Pokhrel
On Tue, Mar 19, 2013 at 8:27 PM, Mulyadi Santosa mulyadi.sant...@gmail.comwrote: Hi Niroj Please see inlined answer below... On Mon, Mar 18, 2013 at 5:28 PM, Niroj Pokhrel nirojpokh...@gmail.com wrote: Hi all, As I have read, whenever we execute a program, the memory is allocated in

Re: Memory allocations in linux for processes

2013-03-19 Thread Valdis . Kletnieks
On Tue, 19 Mar 2013 20:41:55 +0530, Niroj Pokhrel said: #includestdio.h int main() { while(1) { } return 0; } I don't understand where does mmap or malloc come in to play in this code. Unless you linked it statically, a lot of stuff happens before you ever get to main()

Memory allocations in linux for processes

2013-03-18 Thread Niroj Pokhrel
Hi all, As I have read, whenever we execute a program, the memory is allocated in different sections viz stack, text and data segment. But, since we have used loader and linker the three allocations will happen for them too. But when I ran a program and did pmap pid, I saw several other fields