Slide 1

Slide 1 text

Angelina Ballerina Learns about Memory Allocation Allison McMillan @allie_p

Slide 2

Slide 2 text

https://www.khanacademy.org/computing/computer-programming/programming-games-visualizations/memory-game/a/intro-to-memory

Slide 3

Slide 3 text

Photo: Getty Images

Slide 4

Slide 4 text

BRYAN WOOLSTON / Reuters MinnPost illustration by Jaime Anderson http://www.clotureclub.com/2013/07/22-things-most-dc-people-do/

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

https://www.youtube.com/watch?v=GFfGzNXnJE8

Slide 11

Slide 11 text

https://digiday.com/marketing/the-new-face-of-programmatic-efficacy-over-efficiency/

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

First Seek to Understand - Stephen Covey

Slide 14

Slide 14 text

http://www.buzinga.com.au/buzz/app-development-jargon-glossary/

Slide 15

Slide 15 text

http://blackgeekygirl.deviantart.com/art/Little-Miss-Smartypants-515026930

Slide 16

Slide 16 text

Definitions Scenarios Concepts Tools

Slide 17

Slide 17 text

https://www.goodreads.com/book/show/492812.Angelina_Ballerina

Slide 18

Slide 18 text

http://bookinwithbingo.blogspot.com/2011/04/

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

https://www.pinterest.com

Slide 21

Slide 21 text

No content

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

http://www.wikihow.com/Find-Your-Own-Dancing-Style

Slide 24

Slide 24 text

www.pinterest.com

Slide 25

Slide 25 text

https://www.pinterest.com/pin/497507090057749846/

Slide 26

Slide 26 text

https://s-media-cache-ak0.pinimg.com/originals/01/69/1a/01691a66976f8e035a34990fb63e22de.jpg

Slide 27

Slide 27 text

http://www.vashtie.com/culture/disneys-aladdin-still-us-dreaming-three-wishes/

Slide 28

Slide 28 text

No content

Slide 29

Slide 29 text

No content

Slide 30

Slide 30 text

No content

Slide 31

Slide 31 text

https://giphy.com/gifs/jecamartinez-ballet-ballerina-tippy-toes-yoJC2K2zjyPhKzg8lq

Slide 32

Slide 32 text

http://gifsgallery.com/angelina+ballerina+gif

Slide 33

Slide 33 text

https://giphy.com/gifs/loop-ballet-perfection-Ez1XmttaHzjQ4

Slide 34

Slide 34 text

No content

Slide 35

Slide 35 text

No content

Slide 36

Slide 36 text

No content

Slide 37

Slide 37 text

No content

Slide 38

Slide 38 text

No content

Slide 39

Slide 39 text

https://www.pinterest.com/pin/766245324070166230/

Slide 40

Slide 40 text

Memory Can I have a box?

Slide 41

Slide 41 text

+ Memory

Slide 42

Slide 42 text

Heap Stack

Slide 43

Slide 43 text

Stack Clean room Help with dinner Do a chore

Slide 44

Slide 44 text

Heap

Slide 45

Slide 45 text

http://code.chaoscreated.com/

Slide 46

Slide 46 text

Heap Turn Position Technique

Slide 47

Slide 47 text

Heap Machine Heap Ruby Heap

Slide 48

Slide 48 text

Heap Dance Heap Ballet Heap

Slide 49

Slide 49 text

Heap Dance Heap Ballet Heap Page Page Page

Slide 50

Slide 50 text

Heap Machine Heap Ruby Heap Page Node/Slot Ruby Object

Slide 51

Slide 51 text

Heap Dance Heap Ballet Heap Feet Positions Node/Slot First position Node/Slot Fourth position https://dancer.com/ballet-info/in-the-studio/terms-positions/

Slide 52

Slide 52 text

Open slot

Slide 53

Slide 53 text

new first open slot Bump Pointer Allocation

Slide 54

Slide 54 text

Eden page Retained objects

Slide 55

Slide 55 text

http://artandpractice.blogspot.nl/2013/04/huma-1315-chapter-8-dance.html new memory

Slide 56

Slide 56 text

No content

Slide 57

Slide 57 text

No content

Slide 58

Slide 58 text

No content

Slide 59

Slide 59 text

Garbage collection is a type of automatic memory management that makes a program seem like it has infinite memory by reclaiming objects that are no longer in use.

Slide 60

Slide 60 text

www.youtube.com

Slide 61

Slide 61 text

https://alchetron.com/John-McCarthy-(computer-scientist)-1012892-W

Slide 62

Slide 62 text

http://imgur.com/gallery/btPUV

Slide 63

Slide 63 text

https://giphy.com/gifs/cheezburger-funny-amazing-76D0WNoMfMOyc

Slide 64

Slide 64 text

https://en.wikipedia.org/wiki/Box_Step

Slide 65

Slide 65 text

http://makeagif.com/gif/stanford-viennese-ball-2013-opening-committee-waltz-cH-YJy

Slide 66

Slide 66 text

Heap

Slide 67

Slide 67 text

Heap

Slide 68

Slide 68 text

Heap

Slide 69

Slide 69 text

Object Graph Heap object Root References References Heap object Heap object

Slide 70

Slide 70 text

http://classicalballetnews.com/how-to-releve-in-ballet-video/how-to-releve-in-ballet/

Slide 71

Slide 71 text

Stack Clean room Help with dinner Do a chore Angelina, Clean your room

Slide 72

Slide 72 text

Ballet Heap Page

Slide 73

Slide 73 text

https://www.tumblr.com/search/ballet%20perfection

Slide 74

Slide 74 text

Granule Chunk Lists

Slide 75

Slide 75 text

Slot Slot Slot Slot

Slide 76

Slide 76 text

Slot Slot Slot Slot r value

Slide 77

Slide 77 text

https://speakerdeck.com/pat_shaughnessy/visualizing-garbage-collection-in-rubinius-jruby-and-ruby-2-dot-0

Slide 78

Slide 78 text

“first position” class: Position Object: position1 = Position.new

Slide 79

Slide 79 text

Object: position1 = Position.new Address

Slide 80

Slide 80 text

No content

Slide 81

Slide 81 text

Program Footprint

Slide 82

Slide 82 text

https://www.pinterest.com

Slide 83

Slide 83 text

Object Space

Slide 84

Slide 84 text

Mutator Collector

Slide 85

Slide 85 text

https://hirshhorn.si.edu/kusama/infinity-rooms/

Slide 86

Slide 86 text

http://gifrific.com/baby-groot-dancing-guardians-of-the-galaxy/

Slide 87

Slide 87 text

http://www.blu-ray.com/movies/screenshot.php?movieid=44938&position=5

Slide 88

Slide 88 text

Root

Slide 89

Slide 89 text

https://www.gutenberg.org/files/27367/27367-h/27367-h.htm Root

Slide 90

Slide 90 text

Root

Slide 91

Slide 91 text

https://www.americandancesportcenter.com/waltz

Slide 92

Slide 92 text

http://tech.eu/features/2921/enevo-waste-management-profile/

Slide 93

Slide 93 text

Root

Slide 94

Slide 94 text

1 1 1 1 1 0 0 0

Slide 95

Slide 95 text

1 1 1 1 1 0 0 0

Slide 96

Slide 96 text

https://pixabay.com/en/playmobil-toy-garbage-collector-771313/

Slide 97

Slide 97 text

FromSpace ToSpace

Slide 98

Slide 98 text

FromSpace ToSpace

Slide 99

Slide 99 text

Pointer FromSpace ToSpace

Slide 100

Slide 100 text

FromSpace (formerly ToSpace) ToSpace

Slide 101

Slide 101 text

FromSpace

Slide 102

Slide 102 text

Mark Sweep Compact

Slide 103

Slide 103 text

Root

Slide 104

Slide 104 text

Root

Slide 105

Slide 105 text

Root

Slide 106

Slide 106 text

Root

Slide 107

Slide 107 text

Root

Slide 108

Slide 108 text

Root

Slide 109

Slide 109 text

https://giphy.com/gifs/dance-black-and-white-dancing-FobM3MLsUVmnu

Slide 110

Slide 110 text

https://dribbble.com/shots/3588547-Hiplet-Desigual-2

Slide 111

Slide 111 text

Generation 0 Generation 1 Root

Slide 112

Slide 112 text

Generation 0 Root

Slide 113

Slide 113 text

Generation 0 Root

Slide 114

Slide 114 text

Generation 0 Root

Slide 115

Slide 115 text

Generation 1 Root

Slide 116

Slide 116 text

Generation 1 Generation 0 Root

Slide 117

Slide 117 text

Generation 1 Generation 0 Root

Slide 118

Slide 118 text

Generation 1 Generation 0 Root

Slide 119

Slide 119 text

Generation 1 Generation 0 Root

Slide 120

Slide 120 text

Write barrier Generation 1 Generation 0 Root

Slide 121

Slide 121 text

Generation 1 Generation 0 Root

Slide 122

Slide 122 text

Dancing with the stars

Slide 123

Slide 123 text

https://coderwall.com/p/yutdhq/understanding-garbage-collection-p1-2

Slide 124

Slide 124 text

Root

Slide 125

Slide 125 text

Root

Slide 126

Slide 126 text

https://giphy.com/gifs/agentm-agent-m-Xdcj75alQutVe

Slide 127

Slide 127 text

writer barrier Root

Slide 128

Slide 128 text

https://www.pinterest.com/pin/470626229787955295/

Slide 129

Slide 129 text

No content

Slide 130

Slide 130 text

No content

Slide 131

Slide 131 text

No content

Slide 132

Slide 132 text

https://i2.wp.com/sassandbalderdash.com/wp-content/uploads/2014/03/letitgo7.gif

Slide 133

Slide 133 text

Rails Apps Retained Memory Allocated Memory = +

Slide 134

Slide 134 text

No content

Slide 135

Slide 135 text

http://www.pastposters.com/details.php?prodId=4009

Slide 136

Slide 136 text

2.3.1 :001 > GC.stat(:total_freed_objects) => 97198

Slide 137

Slide 137 text

http://gifrific.com/uga-mens-swim-and-dive-team-harlem-shake-dance/

Slide 138

Slide 138 text

{
 :count=>0,
 :heap_allocated_pages=>24,
 :heap_sorted_length=>24,
 :heap_allocatable_pages=>0,
 :heap_available_slots=>9783,
 :heap_live_slots=>7713,
 :heap_free_slots=>2070,
 :heap_final_slots=>0,
 :heap_marked_slots=>0,
 :heap_swept_slots=>0,
 :heap_eden_pages=>24,
 :heap_tomb_pages=>0,
 :total_allocated_pages=>24,
 :total_freed_pages=>0,
 :total_allocated_objects=>7796,
 :total_freed_objects=>83,
 :malloc_increase_bytes=>2389312,
 :malloc_increase_bytes_limit=>16777216,
 :minor_gc_count=>0,
 :major_gc_count=>0,
 :remembered_wb_unprotected_objects=>0,
 :remembered_wb_unprotected_objects_limit=>0,
 :old_objects=>0,
 :old_objects_limit=>0,
 :oldmalloc_increase_bytes=>2389760,
 :oldmalloc_increase_bytes_limit=>16777216
 }

Slide 139

Slide 139 text

Heap Allocated Pages Pages

Slide 140

Slide 140 text

Heap Sorted Length Slots

Slide 141

Slide 141 text

Heap available slots Slots

Slide 142

Slide 142 text

Heap live slots

Slide 143

Slide 143 text

Heap Free Slots

Slide 144

Slide 144 text

Heap Final Slots Root

Slide 145

Slide 145 text

Total Allocated Objects Root

Slide 146

Slide 146 text

Total Freed Objects Root

Slide 147

Slide 147 text

2.3.1 :001 > GC.stat[:count]

Slide 148

Slide 148 text

GC::Profiler.enable 10000.times do puts “angelina turns” end GC.start puts GC::Profiler.result GC::Profiler.disable

Slide 149

Slide 149 text

Index 1 Invoke Time(sec) 0.075 Use Size(byte) 584120 Total Size(byte) 1207680 Total Object 30192 GC Time(ms) 1.91500000000000003553

Slide 150

Slide 150 text

> ObjectSpace.each_object

Slide 151

Slide 151 text

Object Space

Slide 152

Slide 152 text

2.3.1 :003 > ObjectSpace.count_objects => {:TOTAL=>53805, :FREE=>7063, :T_OBJECT=>11 10, :T_CLASS=>919, :T_MODULE=>42, :T_FLOAT =>4, :T_STRING=>28307, :T_REGEXP=>195, :T_ ARRAY=>5470, :T_HASH=>180, :T_STRUCT=>3, : T_BIGNUM=>2, :T_FILE=>12, :T_DATA=>269, :T _MATCH=>130, :T_COMPLEX=>1, :T_SYMBOL=>7, :T_IMEMO=>5201, :T_NODE=>4842, :T_ICLASS=> 48}

Slide 153

Slide 153 text

Derailed Benchmarks Memory_profiler Rack-mini-profiler get_process_mem

Slide 154

Slide 154 text

http://harlequinblog.com/2016/08/11-signs-youre-a-book-lover-and-should-be-celebrating-national-book-lovers-day/

Slide 155

Slide 155 text

https://www.emaze.com/@AWZCLQTQ/Rube-Goldberg-Machine

Slide 156

Slide 156 text

Resources http://daydreamsinruby.com/ memory-resources/

Slide 157

Slide 157 text

Thank you

Slide 158

Slide 158 text

@allie_p allison.p.mcmillan@gmail.com www.collectiveidea.com www.daydreamsinruby.com