-
Notifications
You must be signed in to change notification settings - Fork 13
/
Rakefile
50 lines (44 loc) · 1.05 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env rake
require "bundler/gem_tasks"
require 'rake/extensiontask'
Rake::ExtensionTask.new('heap_dump')
desc "Simple dump test,just to check if extension compiles and does not segfault on simple dump"
task :test => :compile do
require "bundler/setup"
require 'heap_dump'
def some_meth
fiber_var = :some_fiber_var2
e = [1,2,3].each # makes enumerator, which references fiber
Fiber.yield
aaa
end
class Fiber
def [](key)
local_fiber_variables[key]
end
def []=(key,value)
local_fiber_variables[key] = value
end
private
def local_fiber_variables
@local_fiber_variables ||= {}
end
end
require 'fiber'
Fiber.new{
fiber_var = :some_fiber_var
Fiber.current[:some_fiber_ivar] = :ivar_cool_value
some_meth
Fiber.yield e
fiber_var = :some_fiber_var3
}.resume
$some_global = "value_global"
puts "Dumping...(rake)"
HeapDump.verbose = true
HeapDump.dump
puts "Done"
class A; end
A.new
puts HeapDump.count_objects [A]
end
task :default => :test