summaryrefslogtreecommitdiff
path: root/gc/gc_impl.h
AgeCommit message (Collapse)Author
2024-10-23Make rb_gc_impl_stat_heap return a VALUE instead of size_tPeter Zhu
Notes: Merged: https://github.com/ruby/ruby/pull/11932
2024-10-23Make rb_gc_impl_stat return a VALUE instead of size_tPeter Zhu
Notes: Merged: https://github.com/ruby/ruby/pull/11932
2024-10-10Move return value of rb_gc_impl_config_set to gc.cPeter Zhu
Notes: Merged: https://github.com/ruby/ruby/pull/11870
2024-10-03Rename size_pool -> heapMatt Valentine-House
Now that we've inlined the eden_heap into the size_pool, we should rename the size_pool to heap. So that Ruby contains multiple heaps, with different sized objects. The term heap as a collection of memory pages is more in memory management nomenclature, whereas size_pool was a name chosen out of necessity during the development of the Variable Width Allocation features of Ruby. The concept of size pools was introduced in order to facilitate different sized objects (other than the default 40 bytes). They wrapped the eden heap and the tomb heap, and some related state, and provided a reasonably simple way of duplicating all related concerns, to provide multiple pools that all shared the same structure but held different objects. Since then various changes have happend in Ruby's memory layout: * The concept of tomb heaps has been replaced by a global free pages list, with each page having it's slot size reconfigured at the point when it is resurrected * the eden heap has been inlined into the size pool itself, so that now the size pool directly controls the free_pages list, the sweeping page, the compaction cursor and the other state that was previously being managed by the eden heap. Now that there is no need for a heap wrapper, we should refer to the collection of pages containing Ruby objects as a heap again rather than a size pool Notes: Merged: https://github.com/ruby/ruby/pull/11771
2024-09-19Remove rb_gc_impl_initial_stress_setPeter Zhu
Notes: Merged: https://github.com/ruby/ruby/pull/11646
2024-09-18Change rb_gc_impl_get_measure_total_time to return a boolPeter Zhu
Notes: Merged: https://github.com/ruby/ruby/pull/11638
2024-09-17Make rb_gc_impl_set_measure_total_time return voidPeter Zhu
Notes: Merged: https://github.com/ruby/ruby/pull/11637
2024-09-17Rename rb_gc_impl_get_profile_total_time to rb_gc_impl_get_total_timePeter Zhu
Notes: Merged: https://github.com/ruby/ruby/pull/11639
2024-09-17Change rb_gc_impl_get_profile_total_time to return unsigned long longPeter Zhu
Notes: Merged: https://github.com/ruby/ruby/pull/11639
2024-08-09Remove rb_gc_impl_objspace_markPeter Zhu
It's not necessary for the GC implementation to call rb_gc_mark_roots which calls back into the GC implementation's rb_gc_impl_objspace_mark. Notes: Merged: https://github.com/ruby/ruby/pull/11325
2024-07-26Put the default GC implementation back into gc.oAlan Wu
We discovered that having gc.o and gc_impl.o in separate translation units diminishes codegen quality with GCC 11 on x86-64. This commit solves that problem by including default/gc.c into gc.c, letting the optimizer have visibility into the body of functions again in builds not using link-time optimization, which are common. This effectively restores things to the way they were before [Feature #20470] from the optimizer's perspective while maintaining the ability to build gc/default.c as a DSO. There were a few functions duplicated across gc.c and gc/default.c. Extract them and put them into gc/gc.h.
2024-07-19Make rb_gc_impl_undefine_finalizer return voidPeter Zhu
Notes: Merged: https://github.com/ruby/ruby/pull/11199
2024-07-15Rename GC_IMPL_H macro to GC_GC_IMPL_HPeter Zhu
2024-07-12Provide GC.config to disable major GC collectionsMatt Valentine-House
This feature provides a new method `GC.config` that configures internal GC configuration variables provided by an individual GC implementation. Implemented in this PR is the option `full_mark`: a boolean value that will determine whether the Ruby GC is allowed to run a major collection while the process is running. It has the following semantics This feature configures Ruby's GC to only run minor GC's. It's designed to give users relying on Out of Band GC complete control over when a major GC is run. Configuring `full_mark: false` does two main things: * Never runs a Major GC. When the heap runs out of space during a minor and when a major would traditionally be run, instead we allocate more heap pages, and mark objspace as needing a major GC. * Don't increment object ages. We don't promote objects during GC, this will cause every object to be scanned on every minor. This is an intentional trade-off between minor GC's doing more work every time, and potentially promoting objects that will then never be GC'd. The intention behind not aging objects is that users of this feature should use a preforking web server, or some other method of pre-warming the oldgen (like Nakayoshi fork)before disabling Majors. That way most objects that are going to be old will have already been promoted. This will interleave major and minor GC collections in exactly the same what that the Ruby GC runs in versions previously to this. This is the default behaviour. * This new method has the following extra semantics: - `GC.config` with no arguments returns a hash of the keys of the currently configured GC - `GC.config` with a key pair (eg. `GC.config(full_mark: true)` sets the matching config key to the corresponding value and returns the entire known config hash, including the new values. If the key does not exist, `nil` is returned * When a minor GC is run, Ruby sets an internal status flag to determine whether the next GC will be a major or a minor. When `full_mark: false` this flag is ignored and every GC will be a minor. This status flag can be accessed at `GC.latest_gc_info(:needs_major_by)`. Any value other than `nil` means that the next collection would have been a major. Thus it's possible to use this feature to check at a predetermined time, whether a major GC is necessary and run one if it is. eg. After a request has finished processing. ```ruby if GC.latest_gc_info(:needs_major_by) GC.start(full_mark: true) end ``` [Feature #20443]
2024-07-12Add gc/gc_impl.h for GC implementation headersPeter Zhu