diff options
| author | Nathan Froyd <froydnj@gmail.com> | 2023-09-18 13:35:58 -0400 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2023-09-19 16:11:27 +0000 |
| commit | c7875340be63201adde698405d0c8a81a313d5bf (patch) | |
| tree | e6b5ef017a7c77114a8038185643808d3ae64b39 | |
| parent | 18622403acfb1e398a07b05d21d2ab39972c339e (diff) | |
[ruby/yarp] fix computation of memsize for constant id lists
https://github.com/ruby/yarp/commit/df72517fd1
| -rw-r--r-- | yarp/templates/src/node.c.erb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/yarp/templates/src/node.c.erb b/yarp/templates/src/node.c.erb index 7ce54f2011..f21144f169 100644 --- a/yarp/templates/src/node.c.erb +++ b/yarp/templates/src/node.c.erb @@ -106,6 +106,10 @@ yp_node_memsize_node(yp_node_t *node, yp_memsize_t *memsize) { // Node lists will add in their own sizes below. memsize->memsize -= sizeof(yp_node_list_t) * <%= node.fields.count { |f| f.is_a?(YARP::NodeListField) } %>; <%- end -%> + <%- if node.fields.any? { |f| f.is_a?(YARP::ConstantListField) } -%> + // Constant id lists will add in their own sizes below. + memsize->memsize -= sizeof(yp_constant_id_list_t) * <%= node.fields.count { |f| f.is_a?(YARP::ConstantListField) } %>; + <%- end -%> <%- node.fields.each do |field| -%> <%- case field -%> <%- when YARP::ConstantField, YARP::OptionalConstantField, YARP::UInt32Field, YARP::FlagsField, YARP::LocationField, YARP::OptionalLocationField -%> |
