Search
Project
General
Profile
Sign in
Register
Home
Projects
Help
Search
:
Ruby master
All Projects
Ruby
»
Ruby master
Overview
Activity
Roadmap
Issues
Repository
Like
Download (445 Bytes)
Feature #3203
» bm_gc_fragmentation.rb
authorNari (Narihiro Nakamura)
, 04/27/2010 01:11 AM
# Make pseudo flagmentation in a ruby objects heap.
GC
::
Profiler
.
enable
if
$DEBUG
M
=
1000000
B
=
2
*
5
*
(
4
**
3
)
+
1
A
=
100001
def
make_fragmentation
(
h
,
seed
)
i
=
seed
10000
.
times
{
|
m
|
h
<<
Object
.
new
}
10000
.
times
{
|
m
|
i
=
((
A
*
i
)
+
B
)
%
M
h
[
i
%
h
.
length
]
=
nil
}
end
heaps
=
[]
100
.
times
{
|
i
|
make_fragmentation
(
heaps
,
i
)
}
if
$DEBUG
GC
::
Profiler
.
report
puts
GC
::
Profiler
.
total_time
end
« Previous
1
2
Next »
(1-1/2)
Loading...