Skip to content
Snippets Groups Projects
Select Git revision
  • master default protected
  • v1.0.5
  • v1.0.4
  • v1.0.3
  • v1.0.2
  • v1.0.1
6 results

liballocations.c

  • Yorick Peterse's avatar
    52f3388b
    Fixed getting classes from Tracepoint objects · 52f3388b
    Yorick Peterse authored
    Apparently when using RBASIC_CLASS() sometimes Ruby returns something
    that _looks_ like a VALUE but isn't. This results in Ruby sometimes
    treating it as a Fixnum of sorts while in other cases it just segfaults.
    
    To work around this we're now using rb_tracearg_defined_class() to get
    an object class, which seems to be the correct way of doing it (based on
    digging through the MRI source code).
    
    One small nuisance is that we now also get singleton classes which we
    generally don't care about (since there's always only one of them). This
    means we'll need to filter these out whenever we generate a Ruby Hash
    containing the counts per class. Of course MRI doesn't provide a sane
    API for this (that doesn't involve calling Ruby methods) so we instead
    use the same logic as MRI's implementation of Class#singleton_class?
    uses.
    Verified
    52f3388b
    History
    Fixed getting classes from Tracepoint objects
    Yorick Peterse authored
    Apparently when using RBASIC_CLASS() sometimes Ruby returns something
    that _looks_ like a VALUE but isn't. This results in Ruby sometimes
    treating it as a Fixnum of sorts while in other cases it just segfaults.
    
    To work around this we're now using rb_tracearg_defined_class() to get
    an object class, which seems to be the correct way of doing it (based on
    digging through the MRI source code).
    
    One small nuisance is that we now also get singleton classes which we
    generally don't care about (since there's always only one of them). This
    means we'll need to filter these out whenever we generate a Ruby Hash
    containing the counts per class. Of course MRI doesn't provide a sane
    API for this (that doesn't involve calling Ruby methods) so we instead
    use the same logic as MRI's implementation of Class#singleton_class?
    uses.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.