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
not be considered to be binary. Fixes Psych / GH 166
https://github.com/tenderlove/psych/issues/166
* test/psych/test_string.rb: test for fix
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43469 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ext/openssl/depend (ossl.o): work around of dependency of
thread_native.h, which depends on headers by THREAD_MODEL.
[ruby-dev:47777]
* ext/openssl/extconf.rb: need THREAD_MODEL.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43451 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
rb_thread_call_without_gvl2.
(readline_rl_instream, readline_rl_outstream): Record FILE
structures allocated by this extension.
(getc_body): New function extracted from readline_getc.
(getc_func): New function.
(readline_getc): Use rb_thread_call_without_gvl2 to invoke getc_func.
[ruby-dev:47033] [Bug #8749]
(clear_rl_instream, clear_rl_outstream): Close FILE structure
allocated by this extention reliably. [ruby-core:57951] [Bug #9040]
(readline_readline): Use clear_rl_instream and clear_rl_outstream.
(readline_s_set_input): Set readline_rl_instream.
(readline_s_set_output): Set readline_rl_outstream.
(Init_readline): Don't call readline_s_set_input because
readline_getc doesn't block other threads for any FILE structure now.
[ruby-dev:47033] [Bug #8749] reported by Nobuhiro IMAI.
[ruby-core:57951] [Bug #9040] reporeted by Eamonn Webster.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* variable.c (rb_class2name): should return real class name, not
singleton class or iclass.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43367 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ext/-test-/bug_reporter/bug_reporter.c (sample_bug_reporter): cast
via uintptr_t to suppress warning cast between pointer and different
size integer by gcc 4.8.
* ext/-test-/bug_reporter/bug_reporter.c (register_sample_bug_reporter):
ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43339 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
comments for Curses, including period spacing and column width.
This patch also fixed some typos. Thanks to @postmodern for the patch!
[Fixes GH-420] https://github.com/ruby/ruby/pull/420
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43316 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
rb_bug_reporter_add() allows to register a function which
is called at rb_bug() called.
* ext/-test-/bug_reporter/bug_reporter.c: add a test for this C-API.
* ext/-test-/bug_reporter/extconf.rb: ditto.
* test/-ext-/bug_reporter/test_bug_reporter.rb: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43303 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
* lib/mkmf.rb (have_framework): should append framework options to
$LIBS, not $LDFLAGS. the former is propagated to exts.mk when
enable-static-linked-ext.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43277 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
vm_backtrace.c (rb_profile_frame_full_label): add new C API
rb_profile_frame_full_label() which returns label with
qualified method name.
Note that in future version of Ruby label() may return
same return value of full_label().
* ext/-test-/debug/profile_frames.c,
test/-ext-/debug/test_profile_frames.rb: fix a test for this change.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43205 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
test/-ext-/debug/test_profile_frames.rb: add a test for new C-APIs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43171 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
When a system had no interface, this function used xmalloc for root
but did not return any reference to it. This patch fixes it by
immediately returning an empty array if no interface is found.
Coverity Scan found this bug.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43121 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
* parse.y (rb_id_attrset): fix inconsistency with literals, allow
ID_ATTRSET and return it itself, but ID_JUNK cannot make ID_ATTRSET.
and raise a NameError instead of rb_bug() for invalid argument.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43083 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ext/curses/curses.c (NUM2CH, CH2NUM): use proper macros for
the size of chtype.
[ruby-core:56090] [Bug #8659]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43074 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This includes fixing the capitalization of Infinity, return value of
example "BigDecimal.new('NaN') == 0.0", and code style in example.
[Fixes GH-398] https://github.com/ruby/ruby/pull/398
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43057 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ext/win32/lib/win32/registry.rb (Win32::Registry#write): data size
is in bytes, not chars. terminators should be placed automatically.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43031 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ext/win32/lib/win32/registry.rb (Win32::Registry::API#EnumKey):
size of the name is in WCHARs, not in bytes.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43029 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ext/win32/lib/win32/registry.rb (Win32::Registry::API): need
Constants.
* ext/win32/lib/win32/registry.rb (Win32::Registry::API#EnumValue):
size of the name is in WCHARs, not in bytes
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43026 b2dd03c8-39d4-4d8f-98ff-823fe69b080e