Memory Layout of a C/C++ Program



Comments

Comments about the video from the viewers

Amit Singh

2015

Sorry to say, This Presenter is providing WRONG INFORMATION. Mr amitkeerti have you ever thought how, a program only outputs a.out, And If it sits completely in Code(text) segment then how other segments gets information. I don't think complier stores information each program at it's End. a.out exe has complete information, it does not sits in Text(code Segment). What the Correct thing is this: When we compile a program, a.out is created which has following segments(a.out has segments) 1. .text segment: Stores machine executable code of program (THIS GOES TO TEXT SEGMENT) 2. .rodata: Stores ReadOnly(RO) data, format string, printf, jump to switch 3. .data: Init global variables(THESE GOES TO DATA SEGMENT) 4. .bss: Unit global variables (THESE GOES TO DATA SEGMENT) 5. .symtab : (symbol table) 6. .reltext: location of text sections which needed to be combined with other .obj files 7. .reldata: Relocation information of global variables 8. .debug: Debugging information for variables, globals, typedef, when compiler is given -g option. 9. line: mapping between line number of C code and machine code 10. .strtab: String table for debug and symbol table.

Amitkeerti: Appreciate the detailed comment from Amit Singh. My intent of showing a.out in code segment was to indicate that the text part of the code sits in code segment. Thanks again !

Bhupendra Gupta

2016

thank you sir... :-)

Pedro Salzedo

2015

Excellent Video!!

Prashant Kumar

2015

superliked this video cleared all doubts and confusion...

Xpingwinz

2015

Really liked the video; very informative, thanks!!

Nathan Lucca

2015

Very cool!! (;

MethewsEmbeddedSystems

2015

Thanks man, that was actually pretty helpfull !

Raghu Golla

2015

thanks man..............

Mohammed Abulsoud

2015

Thank you . best one i have watched

Gokul Karthick

2014

thank u very much sir....

firefly

2014

Really helpful...thanks so much

Kapil Kumar

2014

ultimate sir awaesome vid i ve ever seen

Jayaram Prabhu Durairaj

2014

gud one !

mukesh kumar

2014

thanks for posting Amit sir. awesome explanation via animation

Ian Parker

2014

Best memory visualization I have seen on youtube :)

Muthu Kumar .S.H

2014

Good one..

911aggie

2013

Thank you for posting this. Great video!

Read More