Skip to content
  • KJ Tsanaktsidis's avatar
    96e695ad
    Fix flakiness in TestGc#test_thrashing_for_young_objects · 96e695ad
    KJ Tsanaktsidis authored
    I caught a reproduction of this test failing under rr, and was able to
    replay it to isolate the failure. The call to
    `before_stat_heap = GC.stat_heap` is itself allocating a hash, which in
    unlucky circumstances can result in a new page being allocated and thus
    `before_stats[:heap_allocated_pages]` no longer equals
    `after_stats[:heap_allocated_pages]`.
    
    The solution is to use the form of GC.stat/stat_heap which takes a hash
    as an argument, and thus needs to perform no Ruby allocations itself.
    96e695ad
    Fix flakiness in TestGc#test_thrashing_for_young_objects
    KJ Tsanaktsidis authored
    I caught a reproduction of this test failing under rr, and was able to
    replay it to isolate the failure. The call to
    `before_stat_heap = GC.stat_heap` is itself allocating a hash, which in
    unlucky circumstances can result in a new page being allocated and thus
    `before_stats[:heap_allocated_pages]` no longer equals
    `after_stats[:heap_allocated_pages]`.
    
    The solution is to use the form of GC.stat/stat_heap which takes a hash
    as an argument, and thus needs to perform no Ruby allocations itself.
Loading