- Anatomy of a Program in Memory
- Discover memory mapping on real-life example:
- 🚦Node.js🚦 Understanding Garbage Collection and Hunting Memory Leaks in Node.js
- 🚦Golang🚦 Go Memory Management
- 🚦Python🚦 Understanding Memory Usage and Leaks in Our Python Code
- 🚦Python🚦 Profiling Memory Usage in Python
Finish the subtasks (1), (2) and (3) above.
When complete do the following:
- In your
kottans-backend
repoREADME.md
:- add header
## Memory Management
- add answers to the following questions:
- What's going to happen if program reaches maximum limit of stack ?
- What's going to happen if program requests a big (more then 128KB) memory allocation on heap ?
- What's the difference between Text and Data memory segments ?
- add header
- From your terminal list all currently running processes using
ps -a
command and then:- Pick any process you like to check its memory mapping (for instance it can be
bash
process itself) and copy its PID (process ID). - Call
cat /proc/<PID>/maps
to get info about process memory mapping state. Orvmmap -64 -p <PID>
on MAC. - You will get output with allocated memory map. Discover this info to find Memory Mapping Segment, Heap and Stack fragments.
- Copy output of
proc
/vmmap
command. And paste it tokottans-backend
README.md
file after your## Memory Management
answers. Use{content}
Markdown formatting to keep it readable. It should look similar to this:
556dfe5af000-556dfe6b3000 r-xp 00000000 08:08 6553607 /bin/bash 556dfe8b2000-556dfe8b6000 r--p 00103000 08:08 6553607 /bin/bash 556dfe8b6000-556dfe8bf000 rw-p 00107000 08:08 6553607 /bin/bash 556dfe8bf000-556dfe8c9000 rw-p 00000000 00:00 0 556dff36b000-556dff4e3000 rw-p 00000000 00:00 0 [heap] 7f558b397000-7f558b3a2000 r-xp 00000000 08:08 1577916 /lib/x86_64-linux-gnu/libnss_files-2.27.so 7f558b5a3000-7f558b5a9000 rw-p 00000000 00:00 0 7f558b7c1000-7f558b7c3000 rw-p 00000000 00:00 0 7f558bbd9000-7f558c720000 r--p 00000000 08:08 3939013 /usr/lib/locale/locale-archive 7f558c720000-7f558c907000 r-xp 00000000 08:08 1577826 /lib/x86_64-linux-gnu/libc-2.27.so 7f558cb0d000-7f558cb11000 rw-p 00000000 00:00 0 7f558cb11000-7f558cb14000 r-xp 00000000 08:08 1577849 /lib/x86_64-linux-gnu/libdl-2.27.so 7f558cb14000-7f558cd13000 ---p 00003000 08:08 1577849 /lib/x86_64-linux-gnu/libdl-2.27.so 7f558cf3f000-7f558cf66000 r-xp 00000000 08:08 1577798 /lib/x86_64-linux-gnu/ld-2.27.so 7f558d148000-7f558d14d000 rw-p 00000000 00:00 0 7f558d15f000-7f558d166000 r--s 00000000 08:08 4196801 /usr/lib/x86_64-linux-gnu/gconv/modules.cache 7f558d166000-7f558d167000 r--p 00027000 08:08 1577798 /lib/x86_64-linux-gnu/ld-2.27.so 7f558d167000-7f558d168000 rw-p 00028000 08:08 1577798 /lib/x86_64-linux-gnu/ld-2.27.so 7f558d168000-7f558d169000 rw-p 00000000 00:00 0 7ffe96b2c000-7ffe96b4d000 rw-p 00000000 00:00 0 [stack] 7ffe96b70000-7ffe96b73000 r--p 00000000 00:00 0 [vvar] 7ffe96b73000-7ffe96b75000 r-xp 00000000 00:00 0 [vdso] ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
- After
proc/maps
output provide examples of Memory Mapping Segment, Heap and Stack fragments address. For instance:Heap - 556dff36b000-556dff4e3000
,Stack - 7ffe96b2c000-7ffe96b4d000
,MMS - 7f558b397000-7f558b3a2000
.
- Pick any process you like to check its memory mapping (for instance it can be
- In your
kottans-backend
repoREADME.md
list your reflections on all subtasks (what was new to you, what surprised you, what you intend to use in future) - You did a lot already! If you honestly finished all the previous steps then go ahead
and share it with others – post a message in course channel:
Memory Management — #done
(orMemory Management — #p2p_done
if you are p2p course student) and add the link to your repo. This step is important, as it helps mentors to track your progress! - Study Extra Materials below to improve your skills. If you feel it affects your overall course performance consider reverting to those later e.g. when you have all mandatory tasks completed.
- You may skip Optional materials from this task (if any).
When you finish this task you can proceed to the next one.
- 🚦Node.js🚦 Accessing Node.js Memory Using V8 Inspector & Chrome Dev Tools
- 🚦Node.js🚦 Node.js Garbage Collection Explained
- 🚦Golang🚦 Debugging: Simple Memory Leaks in Go
- 🚦Golang🚦 Avoiding Memory Leak in Golang API
- 🚦Golang🚦 Как устроен garbage collector в Go 1.9
➡️ Go forward to TCP. UDP. Network