aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/ruby/ext
diff options
context:
space:
mode:
authorGravatar Tim Emiola <temiola@google.com>2015-04-10 12:48:00 -0700
committerGravatar Tim Emiola <temiola@google.com>2015-04-10 15:04:34 -0700
commit2efdebaaaa3ee9cd7b763088b2bb96cca6747da7 (patch)
tree989146e7da7f05e5d2a8a55e2fec692925de7f27 /src/ruby/ext
parent89cc87359f02e17877d908b00e44347a2a16cf69 (diff)
Adds comments to clarify memory handling
Diffstat (limited to 'src/ruby/ext')
-rw-r--r--src/ruby/ext/grpc/rb_call.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/ruby/ext/grpc/rb_call.c b/src/ruby/ext/grpc/rb_call.c
index 7e9c3fbe9f..5910c9f6ab 100644
--- a/src/ruby/ext/grpc/rb_call.c
+++ b/src/ruby/ext/grpc/rb_call.c
@@ -414,6 +414,8 @@ static void grpc_run_batch_stack_fill_ops(run_batch_stack* st, VALUE ops_hash) {
this_value = rb_hash_aref(ops_hash, this_op);
switch(NUM2INT(this_op)) {
case GRPC_OP_SEND_INITIAL_METADATA:
+ /* N.B. later there is no need to explicitly delete the metadata keys
+ * and values, they are references to data in ruby objects. */
grpc_rb_md_ary_convert(this_value, &st->send_metadata);
st->ops[st->op_num].data.send_initial_metadata.count =
st->send_metadata.count;
@@ -428,6 +430,8 @@ static void grpc_run_batch_stack_fill_ops(run_batch_stack* st, VALUE ops_hash) {
case GRPC_OP_SEND_CLOSE_FROM_CLIENT:
break;
case GRPC_OP_SEND_STATUS_FROM_SERVER:
+ /* N.B. later there is no need to explicitly delete the metadata keys
+ * and values, they are references to data in ruby objects. */
grpc_rb_op_update_status_from_server(&st->ops[st->op_num],
&st->send_trailing_metadata,
this_value);
@@ -475,6 +479,7 @@ static VALUE grpc_run_batch_stack_build_result(run_batch_stack* st) {
break;
case GRPC_OP_SEND_MESSAGE:
rb_struct_aset(result, sym_send_message, Qtrue);
+ grpc_byte_buffer_destroy(st->ops[st->op_num].data.send_message);
break;
case GRPC_OP_SEND_CLOSE_FROM_CLIENT:
rb_struct_aset(result, sym_send_close, Qtrue);