Return all reachable objects from ‘obj’.
This method returns all reachable objects from ‘obj’.
If ‘obj’ has two or more references to the same object ‘x’, then returned array only includes one ‘x’ object.
If ‘obj’ is a non-markable (non-heap management) object such as true, false, nil, symbols and Fixnums (and Flonum) then it simply returns nil.
If ‘obj’ has references to an internal object, then it returns instances of ObjectSpace::InternalObjectWrapper
class. This object contains a reference to an internal object and you can check the type of internal object with ‘type’ method.
If ‘obj’ is instance of ObjectSpace::InternalObjectWrapper
class, then this method returns all reachable object from an internal object, which is pointed by ‘obj’.
With this method, you can find memory leaks.
This method is only expected to work with C Ruby
.
Example:
ObjectSpace.reachable_objects_from(['a', 'b', 'c']) #=> [Array, 'a', 'b', 'c'] ObjectSpace.reachable_objects_from(['a', 'a', 'a']) #=> [Array, 'a', 'a', 'a'] # all 'a' strings have different object id ObjectSpace.reachable_objects_from([v = 'a', v, v]) #=> [Array, 'a'] ObjectSpace.reachable_objects_from(1) #=> nil # 1 is not markable (heap managed) object
Enables measuring GC time. You can get the result with GC.stat(:time)
. Note that GC time measurement can cause some performance overhead.
Returns the measure_total_time
flag (default: true
). Note that measurement can affect the application’s performance.
The number of paths in the +$LOAD_PATH+ from activated gems. Used to prioritize -I
and ENV['RUBYLIB']
entries during require
.
Regexp
for require-able plugin suffixes.
Paths where RubyGems’ .rb files and bin files are installed
Mirror the Prism.parse_file_failure?
API by using the serialization API.
Derives a shared secret by ECDH. pubkey must be an instance of OpenSSL::PKey::EC::Point
and must belong to the same group.
This method is provided for backwards compatibility, and calls derive
internally.
Returns the current session cache size. Zero is used to represent an unlimited cache size.
Sets the session cache size. Returns the previously valid session cache size. Zero is used to represent an unlimited session cache size.
Fetch the start character offset of the value.
Fetch the end character column of the value.
Create a code units cache for the given encoding.
Create a code units cache for the given encoding from the source.
Configure the code unit offsets field for this repository for a specific encoding and return self.
Parses a source buffer and returns the AST and the source code comments.
“foo” ^^^^^