Bug #6821

GC::Profiler.enabled? returns 0 when enabled

Added by Dirkjan Bussink almost 3 years ago. Updated almost 3 years ago.

[ruby-core:46919]
Status:Closed
Priority:Normal
Assignee:Narihiro Nakamura
ruby -v:1.9.3p194 Backport:

Description

GC::Profiler.enabled? returns 0 when GC::Profiler is enabled, contrary to the documentation that states it returns either true or false. Looking at the code, I think it's an oversight because objspace->profile.run isn't properly wrapped for a VALUE. So TRUE is returned, which is 1 as a VALUE which equals the value for the Fixnum 0.

This changeset should fix the problem:

https://gist.github.com/9fe02bd47515cbbcced7

Associated revisions

Revision 36593
Added by nari almost 3 years ago

  • gc.c: return true or false. Patch by Dirkjan Bussink. [Bug #6821]

  • test/ruby/test_gc.rb: add test-case for this bug.

Revision 36593
Added by nari almost 3 years ago

  • gc.c: return true or false. Patch by Dirkjan Bussink. [Bug #6821]

  • test/ruby/test_gc.rb: add test-case for this bug.

History

#1 Updated by Nobuyoshi Nakada almost 3 years ago

  • Category set to core
  • Status changed from Open to Assigned
  • Assignee set to Narihiro Nakamura
  • Target version set to 2.0.0

#2 Updated by Narihiro Nakamura almost 3 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r36593.
Dirkjan, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • gc.c: return true or false. Patch by Dirkjan Bussink. [Bug #6821]

  • test/ruby/test_gc.rb: add test-case for this bug.

Also available in: Atom PDF