|
13 | 13 |
|
14 | 14 | enum { |
15 | 15 | DEBUG = 0, |
16 | | - DEBUG_FREED_QUEUE = 0, |
| 16 | + DEBUG_EVENT_QUEUES = 0, |
17 | 17 | DEBUG_STATE = 0, |
18 | 18 | }; |
19 | 19 |
|
@@ -235,7 +235,7 @@ static void Memory_Profiler_Capture_process_queues(void *arg) { |
235 | 235 | struct Memory_Profiler_Capture *capture; |
236 | 236 | TypedData_Get_Struct(self, struct Memory_Profiler_Capture, &Memory_Profiler_Capture_type, capture); |
237 | 237 |
|
238 | | - if (DEBUG_FREED_QUEUE) fprintf(stderr, "Processing queues: %zu newobj, %zu freeobj\n", |
| 238 | + if (DEBUG_EVENT_QUEUES) fprintf(stderr, "Processing queues: %zu newobj, %zu freeobj\n", |
239 | 239 | capture->newobj_queue.count, capture->freeobj_queue.count); |
240 | 240 |
|
241 | 241 | // Disable tracking during queue processing to prevent infinite loop |
@@ -308,18 +308,18 @@ static void Memory_Profiler_Capture_newobj_handler(VALUE self, struct Memory_Pro |
308 | 308 | // NOTE: realloc is safe during allocation (doesn't trigger Ruby allocation) |
309 | 309 | struct Memory_Profiler_Newobj_Queue_Item *newobj = Memory_Profiler_Queue_push(&capture->newobj_queue); |
310 | 310 | if (newobj) { |
311 | | - if (DEBUG_FREED_QUEUE) fprintf(stderr, "Queued newobj, queue size now: %zu/%zu\n", |
| 311 | + if (DEBUG_EVENT_QUEUES) fprintf(stderr, "Queued newobj, queue size now: %zu/%zu\n", |
312 | 312 | capture->newobj_queue.count, capture->newobj_queue.capacity); |
313 | 313 | // Write directly to the allocated space |
314 | 314 | newobj->klass = klass; |
315 | 315 | newobj->allocations = allocations; |
316 | 316 | newobj->object = object; |
317 | 317 |
|
318 | 318 | // Trigger postponed job to process the queue |
319 | | - if (DEBUG_FREED_QUEUE) fprintf(stderr, "Triggering postponed job to process queues\n"); |
| 319 | + if (DEBUG_EVENT_QUEUES) fprintf(stderr, "Triggering postponed job to process queues\n"); |
320 | 320 | rb_postponed_job_trigger(capture->postponed_job_handle); |
321 | 321 | } else { |
322 | | - if (DEBUG_FREED_QUEUE) fprintf(stderr, "Failed to queue newobj, out of memory\n"); |
| 322 | + if (DEBUG_EVENT_QUEUES) fprintf(stderr, "Failed to queue newobj, out of memory\n"); |
323 | 323 | } |
324 | 324 | // If push failed (out of memory), silently drop this newobj event |
325 | 325 | } |
@@ -366,18 +366,18 @@ static void Memory_Profiler_Capture_freeobj_handler(VALUE self, struct Memory_Pr |
366 | 366 | // NOTE: realloc is safe during GC (doesn't trigger Ruby allocation) |
367 | 367 | struct Memory_Profiler_Freeobj_Queue_Item *freed = Memory_Profiler_Queue_push(&capture->freeobj_queue); |
368 | 368 | if (freed) { |
369 | | - if (DEBUG_FREED_QUEUE) fprintf(stderr, "Queued freed object, queue size now: %zu/%zu\n", |
| 369 | + if (DEBUG_EVENT_QUEUES) fprintf(stderr, "Queued freed object, queue size now: %zu/%zu\n", |
370 | 370 | capture->freeobj_queue.count, capture->freeobj_queue.capacity); |
371 | 371 | // Write directly to the allocated space |
372 | 372 | freed->klass = klass; |
373 | 373 | freed->allocations = allocations; |
374 | 374 | freed->state = state; |
375 | 375 |
|
376 | 376 | // Trigger postponed job to process both queues after GC |
377 | | - if (DEBUG_FREED_QUEUE) fprintf(stderr, "Triggering postponed job to process queues after GC\n"); |
| 377 | + if (DEBUG_EVENT_QUEUES) fprintf(stderr, "Triggering postponed job to process queues after GC\n"); |
378 | 378 | rb_postponed_job_trigger(capture->postponed_job_handle); |
379 | 379 | } else { |
380 | | - if (DEBUG_FREED_QUEUE) fprintf(stderr, "Failed to queue freed object, out of memory\n"); |
| 380 | + if (DEBUG_EVENT_QUEUES) fprintf(stderr, "Failed to queue freed object, out of memory\n"); |
381 | 381 | } |
382 | 382 | // If push failed (out of memory), silently drop this freeobj event |
383 | 383 | } |
|
0 commit comments