Skip to content
  • Yusuke Endoh's avatar
    42822747
    class.c: calculate the length of Class.descendants in advance · 42822747
    Yusuke Endoh authored
    GC must not be triggered during callback of rb_class_foreach_subclass.
    To prevent GC, we can not use rb_ary_push. Instead, this changeset calls
    rb_class_foreach_subclass twice: first counts the subclasses, then
    allocates a buffer (which may cause GC and reduce subclasses, but not
    increase), and finally stores the subclasses to the buffer.
    
    [Bug #18282] [Feature #14394]
    42822747
    class.c: calculate the length of Class.descendants in advance
    Yusuke Endoh authored
    GC must not be triggered during callback of rb_class_foreach_subclass.
    To prevent GC, we can not use rb_ary_push. Instead, this changeset calls
    rb_class_foreach_subclass twice: first counts the subclasses, then
    allocates a buffer (which may cause GC and reduce subclasses, but not
    increase), and finally stores the subclasses to the buffer.
    
    [Bug #18282] [Feature #14394]
Loading