Angelina Ballerina Learns about Memory Allocation

Angelina Ballerina Learns about Memory Allocation

Memory issues can be a black box often thrown over the fence for the most senior level developers to solve. For newer developers it seems like all of a sudden, your app is failing and you're seeing red everywhere. You've optimized your database queries but are still running into issues. What does this all mean? How do you figure out what's going on without solely passing it off to someone else? You'll walk away from this talk with an understanding of what memory allocation means and the tools you can use to assess what's happening.

Presented at Curry on Conf 2017 and Strange Loop 2017

Fcb33b7af6bc3fa2890946410f154034?s=128

Allison McMillan

June 20, 2017
Tweet

Transcript

  1. Angelina Ballerina Learns about Memory Allocation Allison McMillan @allie_p

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

  3. Photo: Getty Images

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

  5. None
  6. None
  7. None
  8. None
  9. None
  10. https://www.youtube.com/watch?v=GFfGzNXnJE8

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

  12. None
  13. First Seek to Understand - Stephen Covey

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

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

  16. Definitions Scenarios Concepts Tools

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

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

  19. None
  20. https://www.pinterest.com

  21. None
  22. None
  23. http://www.wikihow.com/Find-Your-Own-Dancing-Style

  24. www.pinterest.com

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

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

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

  28. None
  29. None
  30. None
  31. https://giphy.com/gifs/jecamartinez-ballet-ballerina-tippy-toes-yoJC2K2zjyPhKzg8lq

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

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

  34. None
  35. None
  36. None
  37. None
  38. None
  39. https://www.pinterest.com/pin/766245324070166230/

  40. Memory Can I have a box?

  41. + Memory

  42. Heap Stack

  43. Stack Clean room Help with dinner Do a chore

  44. Heap

  45. http://code.chaoscreated.com/

  46. Heap Turn Position Technique

  47. Heap Machine Heap Ruby Heap

  48. Heap Dance Heap Ballet Heap

  49. Heap Dance Heap Ballet Heap Page Page Page

  50. Heap Machine Heap Ruby Heap Page Node/Slot Ruby Object

  51. 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/
  52. Open slot

  53. new first open slot Bump Pointer Allocation

  54. Eden page Retained objects

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

  56. None
  57. None
  58. None
  59. 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.
  60. www.youtube.com

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

  62. http://imgur.com/gallery/btPUV

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

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

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

  66. Heap

  67. Heap

  68. Heap

  69. Object Graph Heap object Root References References Heap object Heap

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

  71. Stack Clean room Help with dinner Do a chore Angelina,

    Clean your room
  72. Ballet Heap Page

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

  74. Granule Chunk Lists

  75. Slot Slot Slot Slot

  76. Slot Slot Slot Slot r value

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

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

  79. Object: position1 = Position.new Address

  80. None
  81. Program Footprint

  82. https://www.pinterest.com

  83. Object Space

  84. Mutator Collector

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

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

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

  88. Root

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

  90. Root

  91. https://www.americandancesportcenter.com/waltz

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

  93. Root

  94. 1 1 1 1 1 0 0 0

  95. 1 1 1 1 1 0 0 0

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

  97. FromSpace ToSpace

  98. FromSpace ToSpace

  99. Pointer FromSpace ToSpace

  100. FromSpace (formerly ToSpace) ToSpace

  101. FromSpace

  102. Mark Sweep Compact

  103. Root

  104. Root

  105. Root

  106. Root

  107. Root

  108. Root

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

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

  111. Generation 0 Generation 1 Root

  112. Generation 0 Root

  113. Generation 0 Root

  114. Generation 0 Root

  115. Generation 1 Root

  116. Generation 1 Generation 0 Root

  117. Generation 1 Generation 0 Root

  118. Generation 1 Generation 0 Root

  119. Generation 1 Generation 0 Root

  120. Write barrier Generation 1 Generation 0 Root

  121. Generation 1 Generation 0 Root

  122. Dancing with the stars

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

  124. Root

  125. Root

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

  127. writer barrier Root

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

  129. None
  130. None
  131. None
  132. https://i2.wp.com/sassandbalderdash.com/wp-content/uploads/2014/03/letitgo7.gif

  133. Rails Apps Retained Memory Allocated Memory = +

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

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

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

  138. {
 :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
 }
  139. Heap Allocated Pages Pages

  140. Heap Sorted Length Slots

  141. Heap available slots Slots

  142. Heap live slots

  143. Heap Free Slots

  144. Heap Final Slots Root

  145. Total Allocated Objects Root

  146. Total Freed Objects Root

  147. 2.3.1 :001 > GC.stat[:count]

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

    GC::Profiler.disable
  149. Index 1 Invoke Time(sec) 0.075 Use Size(byte) 584120 Total Size(byte)

    1207680 Total Object 30192 GC Time(ms) 1.91500000000000003553
  150. > ObjectSpace.each_object

  151. Object Space

  152. 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}
  153. Derailed Benchmarks Memory_profiler Rack-mini-profiler get_process_mem

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

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

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

  157. Thank you

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