зеркало из https://github.com/github/ruby.git
[DOC] Update sample callback of `rb_objspace_each_objects`
* refine liveness check * fix missing closing brace
This commit is contained in:
Родитель
9a1c737dee
Коммит
5944a31614
18
gc.c
18
gc.c
|
@ -3944,14 +3944,16 @@ objspace_each_objects_try(VALUE arg)
|
|||
*
|
||||
* This is a sample callback code to iterate liveness objects:
|
||||
*
|
||||
* int
|
||||
* sample_callback(void *vstart, void *vend, int stride, void *data) {
|
||||
* VALUE v = (VALUE)vstart;
|
||||
* for (; v != (VALUE)vend; v += stride) {
|
||||
* if (RBASIC(v)->flags) { // liveness check
|
||||
* // do something with live object 'v'
|
||||
* }
|
||||
* return 0; // continue to iteration
|
||||
* static int
|
||||
* sample_callback(void *vstart, void *vend, int stride, void *data)
|
||||
* {
|
||||
* VALUE v = (VALUE)vstart;
|
||||
* for (; v != (VALUE)vend; v += stride) {
|
||||
* if (!rb_objspace_internal_object_p(v)) { // liveness check
|
||||
* // do something with live object 'v'
|
||||
* }
|
||||
* }
|
||||
* return 0; // continue to iteration
|
||||
* }
|
||||
*
|
||||
* Note: 'vstart' is not a top of heap_page. This point the first
|
||||
|
|
Загрузка…
Ссылка в новой задаче