Upgrade to Pro — share decks privately, control downloads, hide ads and more …

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

Allison McMillan

June 20, 2017
Tweet

More Decks by Allison McMillan

Other Decks in Technology

Transcript

  1. 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/
  2. 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.
  3. {
 :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
 }
  4. Index 1 Invoke Time(sec) 0.075 Use Size(byte) 584120 Total Size(byte)

    1207680 Total Object 30192 GC Time(ms) 1.91500000000000003553
  5. 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}