|
6 | 6 | #include "ruby.h" |
7 | 7 | #include "ruby/st.h" |
8 | 8 |
|
9 | | -// Per-class allocation tracking record |
| 9 | +// Per-class allocation tracking record: |
10 | 10 | struct Memory_Profiler_Capture_Allocations { |
11 | | - VALUE callback; // Optional Ruby proc/lambda to call on allocation |
12 | | - size_t new_count; // Total allocations seen since tracking started |
13 | | - size_t free_count; // Total frees seen since tracking started |
14 | | - // Live count = new_count - free_count |
| 11 | + // Optional Ruby proc/lambda to call on allocation. |
| 12 | + VALUE callback; |
| 13 | + |
| 14 | + // Total allocations seen since tracking started. |
| 15 | + size_t new_count; |
| 16 | + // // Total frees seen since tracking started. |
| 17 | + size_t free_count; |
| 18 | + // Live count = new_count - free_count. |
15 | 19 |
|
16 | | - // For detailed tracking: map object (VALUE) => state (VALUE) |
17 | | - // State is returned from callback on :newobj and passed back on :freeobj |
| 20 | + // For detailed tracking: map object (VALUE) => state (VALUE). |
| 21 | + // State is returned from callback on `newobj` and passed back on `freeobj`. |
18 | 22 | st_table *object_states; |
19 | 23 | }; |
20 | 24 |
|
21 | | -// Wrap an allocations record in a VALUE |
| 25 | +// Wrap an allocations record in a VALUE. |
22 | 26 | VALUE Memory_Profiler_Allocations_wrap(struct Memory_Profiler_Capture_Allocations *record); |
23 | 27 |
|
24 | | -// Get allocations record from wrapper VALUE |
| 28 | +// Get allocations record from wrapper VALUE. |
25 | 29 | struct Memory_Profiler_Capture_Allocations* Memory_Profiler_Allocations_get(VALUE self); |
26 | 30 |
|
27 | | -// Clear/reset allocation counts and state for a record |
| 31 | +// Clear/reset allocation counts and state for a record. |
28 | 32 | void Memory_Profiler_Allocations_clear(VALUE allocations); |
29 | 33 |
|
30 | | -// Initialize the Allocations class |
| 34 | +// Initialize the Allocations class. |
31 | 35 | void Init_Memory_Profiler_Allocations(VALUE Memory_Profiler); |
0 commit comments