spec_helper.rb 442 B

123456789101112131415161718192021222324
  1. require Pathname(__FILE__).dirname.join('../spec/spec_helper')
  2. module V8::MemSpec
  3. def self.included(cls)
  4. cls.class_eval do
  5. include V8::ExtSpec
  6. before(:all) {V8::C::V8::SetFlagsFromString("--expose-gc")}
  7. end
  8. end
  9. def ruby_gc
  10. current = GC.stress
  11. GC.stress = true
  12. yield
  13. ensure
  14. GC.stress = current
  15. end
  16. def v8_gc
  17. while !c::V8::IdleNotification();end
  18. v8_eval('gc()', 'gc.js')
  19. end
  20. end