diff options
author | Kevin Newton <[email protected]> | 2022-01-11 12:47:22 -0500 |
---|---|---|
committer | Aaron Patterson <[email protected]> | 2022-01-21 14:34:53 -0800 |
commit | fc6fd4c31e957a4b15ba2c03cbd1cea0a8af6513 (patch) | |
tree | ec1681ac98d098f35d2751fd4d33138d3141f8a0 /thread.c | |
parent | 5e3a32021849718ae483eaaa9fbf155f91828039 (diff) |
Accurately report VM memsize
Currently the calculation only counts the size of the struct. This commit adds the size of the associated st tables, id tables, and linked lists.
Still missing is the size of the ractors and (potentially) the size of the object space.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/5428
Diffstat (limited to 'thread.c')
-rw-r--r-- | thread.c | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -5575,6 +5575,21 @@ rb_check_deadlock(rb_ractor_t *r) } } +// Used for VM memsize reporting. Returns the size of a list of waiting_fd +// structs. Defined here because the struct definition lives here as well. +size_t +rb_vm_memsize_waiting_fds(struct list_head *waiting_fds) +{ + struct waiting_fd *waitfd = 0; + size_t size = 0; + + list_for_each(waiting_fds, waitfd, wfd_node) { + size += sizeof(struct waiting_fd); + } + + return size; +} + static void update_line_coverage(VALUE data, const rb_trace_arg_t *trace_arg) { |