* include/ruby/ruby.h: remove INTERNAL_EVENT_GC_END and replace with
two new events: GC_END_MARK and GC_END_SWEEP
* gc.c (gc_after_sweep): emit GC_END_SWEEP after lazy sweep is done
* gc.c (gc_marks_body): emit GC_END_MARK at end of minor/major mark
* ext/-test-/tracepoint/tracepoint.c (struct tracepoint_track): tests
for new events.
* test/-ext-/tracepoint/test_tracepoint.rb (class TestTracepointObj):
ditto.
* NEWS: remove ObjectSpace.after_gc_*_hook. These are only a sample,
and will be removed before ruby 2.1.
* ext/objspace/gc_hook.c: remove ObjectSpace.after_gc_end_hook=
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43997 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
is frozen.
rb_class_path() can modify frozen classes (and causes errors).
This patch is temporary. We need no-modification/no-allocation
class path function.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43856 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ext/objspace/objspace_dump.c (dump_output): allow IO object as
output, and use Tempfile.create and return open file instead of
mkstemp() and path name for :file output.
[ruby-core:58266] [Bug #9102]
* test/objspace/test_objspace.rb (TestObjSpace#dump_my_heap_please):
remove temporary output file.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43679 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ext/objspace/objspace_dump.c (dump_output): fix portability issue.
mkstemp() may not be available.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43608 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
objectspace as json: ObjectSpace.dump_all and ObjectSpace.dump(obj).
These methods are useful for debugging reference leaks and memory growth
in large ruby applications. [Bug #9026] [ruby-core:57893] [Fixes GH-423]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43585 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This is another approach to solve an issue discussed at r43530.
This feature is diabled as default.
This feature measures an increment of memory consuption by oldgen
objects. It measures memory consumption for each objects when
the object is promoted. However, measurement of memory consumption
is not accurate now. So that this measurement is `estimation'.
To implement this feature, move memsize_of() function from
ext/objspace/objspace.c and expose rb_obj_memsize_of().
Some memsize() functions for T_DATA (T_TYPEDDATA) have problem to
measure memory size, so that we ignores T_DATA objects now.
For example, some functions skip NULL check for pointer.
The macro RGENGC_ESTIMATE_OLDSPACE enables/disables this feature,
and turned off as default.
We need to compare 3gen GC and this feature carefully.
(it is possible to enable both feature)
We need a help to compare them.
* internal.h: expose rb_obj_memsize_of().
* ext/objspace/objspace.c: use rb_obj_memsize_of() function.
* cont.c (fiber_memsize): fix to check NULL.
* variable.c (autoload_memsize): ditto.
* vm.c (vm_memsize): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43532 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
There is possibility to remain info due to missing FREEOBJ event.
FREEOBJ events are skipped while suppress_tracing state, for example,
during trace events are invoking.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43327 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
some bugs hits this check.
* ext/objspace/object_tracing.c (object_allocations_reporter_i): cast as pointer.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43318 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
ObjectSpace.trace_object_allocations_debug_start for GC debugging.
If you encounter the BUG "... is T_NONE" (and so on) on your
application, please try this method at the beggining of your app.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43310 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
ObjectSpace.reachable_objects_from_root returns all objects refered
from root (called "root objects").
This feature is for deep object analysis.
* test/objspace/test_objspace.rb: add a test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43301 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ObjectSpace::trace_object_allocations_start
* ObjectSpace::trace_object_allocations_stop
* ObjectSpace::trace_object_allocations_clear
And some refactoring.
* test/objspace/test_objspace.rb: add a test for new methods.
* NEWS: add a description for new methods.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43095 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ext/objspace/objspace.c: try to include overview in rdoc,
see #8537.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
lookup_allocation_info. At times I confused "struct
allocation_info" with "function allocation_info".
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41104 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ext/objspace/object_tracing.c (make_unique_str): fix argument type.
use long for string length.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40975 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
"[ruby-core:55182] [ruby-trunk - Bug #8456][Open] Sugfault in Ruby Head"
Care about the case TracePoint#path #=> `nil'.
* ext/objspace/object_tracing.c: add two new methods:
* ObjectSpace.allocation_class_path(o)
* ObjectSpace.allocation_method_id(o)
They are not useful for Object.new because they are always
"Class" and :new.
To trace more useful information, we need to maintain call-tree
using call/return hooks, which is implemented by
ll-prof <http://sunagae.net/wiki/doku.php?id=software:llprof>
* test/objspace/test_objspace.rb: add a test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40974 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
hook GC invocation.
* ObjectSpace.after_gc_start_hook=(proc)
* ObjectSpace.after_gc_end_hook=(proc)
Note that hooks are not kicked immediately. Procs are kicked
at postponed_job.
This feature is a sample of new internal event and
rb_postponed_job API.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Read the following test to know HOWTO.
This feature is a sample of RUBY_INTERNAL_EVENT.
* test/objspace/test_objspace.rb: add a test.
* ext/objspace/object_tracing.c: ditto.
* gc.c (rb_gc_count): add. THis function returns GC count.
* internal.h: add decl. of rb_gc_count(). Same as `GC.count'.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40957 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
for ObjectSpace.memsize_of().
* test/objspace/test_objspace.rb: add a test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38266 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ext/objspace/objspace.c (type2sym, count_objects_size): use enum
instead of size_t which may be larger than actual values.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37316 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
structure of the result of reachable objects. Keys of table
contains object_id of each reachable objects. Value of table
is an object itself or an instance of InternalObjectWrapper.
To avoid duplication, we use st_table and object_id keys.
* ext/objspace/objspace.c (type2sym): bug fix.
Should use `i' instead of `type'.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37310 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
`ObjectSpace::InternalObjectWrapper#internal_object_id' which returns
an object id of a wrapped internal object.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37308 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
internal object support.
If given object `obj' has references to internal objects
(such as T_NODE objects), then this method returns instances of
`ObjectSpace::InternalObjectWrapper' instead of that internal objects.
This instance contains a refereance to an internal object and you can
check the type of internal object using
`ObjectSpace::InternalObjectWrapper#type' method.
Rdoc of `InternalObjectWrapper' is not prepared yet.
* gc.c (rb_objspace_reachable_objects_from), gc.h: change
an interface of 'rb_objspace_reachable_objects_from()'
* gc.c, gc.h: add two APIs
- rb_objspace_markable_object_p(obj): check markable or not.
- rb_objspace_internal_object_p(obj): check internal or not.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37307 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This method returns an array of objects referenced by given object.
If given object is special objects such as true/false/nil/Fixnum etc
then it returns nil. See rdoc for details.
[ruby-core:39772]
* test/objspace/test_objspace.rb: add a test for this method.
* gc.c: add rb_objspace_reachable_objects_from().
To make this function, add several member `mark_func_data'
to rb_objspace_t. If mark_func_data is not null, then
gc_mark() calls mark_func_data::mark_func.
* gc.h: export rb_objspace_reachable_objects_from().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37094 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Fix rdoc.
* ext/objspace/objspace.c (ObjectSpace.count_tdata_objects):
Change key type if the klass of a object is zero (internal object).
Read rdoc for details.
* internal.h: export rb_objspace_data_type_name().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32323 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
T_CLASS/const_tbl.
a patch from nagachika <nagachika00@gmail.com> [ruby-dev:42490]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29628 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
ObjectSpace.total_memsize_of_all_objects() to
ObjectSpace.memsize_of_all([klass]).
Accept Class object to filter the objects.
* test/objspace/test_objspace.rb: fix test for above change.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29624 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ext/objspace/objspace.c (total_memsize_of_all_objects): added.
* test/objspace/test_objspace.rb:
- add a test for ObjectSpace.total_memsize_of_all_objects.
- add two tests for ObjectSpace.memsize_of (for nil and Fixnum).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29614 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
method management. This change affect some VM control stack structure.
* vm.c, vm_insnhelper.c, vm_method.c, vm_eval.c: ditto. and make some
refactoring.
* insns.def, class.c, eval.c, proc.c, vm_dump.c : ditto.
* vm_core.h, compile.c (iseq_specialized_instruction): remove
VM_CALL_SEND_BIT. use another optimization tech for Kernel#send.
* node.h: remove unused node types.
* ext/objspace/objspace.c (count_nodes): ditto.
* gc.c: add mark/free functions for method entry.
* include/ruby/intern.h: remove decl of
rb_define_notimplement_method_id(). nobody can use it
because noex is not opend.
* iseq.c (iseq_mark): fix to check ic_method is available.
* iseq.c (rb_iseq_disasm): fix to use rb_method_get_iseq().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e