Skip to content

Latest commit

 

History

History
90 lines (78 loc) · 6.88 KB

memory-management.md

File metadata and controls

90 lines (78 loc) · 6.88 KB

MIT Licensed Awesome       

Program in Memory

  1. Anatomy of a Program in Memory
  2. Discover memory mapping on real-life example:
    • Linux systems has pseudo-files system called proc which can be used to get extended info about running processes.
    • Use man proc shell command to get more info about proc or read the same info here
    • If you're Mac user consider to use vmmap or vmmap64 to discover process memory mapping. More info here.
  3. 🚦Node.js🚦 Understanding Garbage Collection and Hunting Memory Leaks in Node.js
  4. 🚦Golang🚦 Go Memory Management
  5. 🚦Python🚦 Understanding Memory Usage and Leaks in Our Python Code
  6. 🚦Python🚦 Profiling Memory Usage in Python

Finish the subtasks (1), (2) and (3) above.

When complete do the following:

  1. In your kottans-backend repo README.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 ?
  2. 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. Or vmmap -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 to kottans-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.
  3. In your kottans-backend repo README.md list your reflections on all subtasks (what was new to you, what surprised you, what you intend to use in future)
  4. 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 (or Memory 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!
  5. 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.
  6. You may skip Optional materials from this task (if any).

When you finish this task you can proceed to the next one.

Extra materials

Done?

➡️ Go forward to TCP. UDP. Network

⤴️ Back to Contents