Hi Yilun,

What do  you mean by free the service? Since I am trying to use this as CLI 
I am not freeing any service. If you mean that I have to free the 
"GetResponseMsg" that I get back as a response then can you please let me 
know how to do that?

Thanks,
Srikanth

On Thursday, March 7, 2019 at 10:08:27 AM UTC-8, [email protected] wrote:
>
> Would you please provide more information about how you free the service? 
> I'm also not sure about how grpc gc works, maybe somebody from grpc team 
> could give better answer.
>
> PS: For manually free arena, you could use Reset 
> <https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/arena.h#L374>
>
> On Wednesday, January 9, 2019 at 5:51:33 PM UTC-8, Srikanth wrote:
>>
>> Hi,
>>
>> I am using gRPC v1.17.2 for implementing CLI for my process. The gRPC 
>> server is in C++ and the client is in Golang. 
>>
>> The protobuf definition looks like this
>>
>> message GetResponseMsg {
>>
>>   repeated GetResponse           response   = 1;    // response
>>
>> }
>>
>> message GetResponse {
>>
>>   Spec         spec       = 1;
>>
>>   Status       status     = 2;
>>
>>   Stats        stats      = 3;
>>
>> }
>>
>>
>> Each Response is probably around 500 Bytes in size all considered. The 
>> number of responses I am trying to retrieve runs to about 200000.
>>
>>
>> The server implementation looks like this
>>
>>
>> Status
>>
>> Get(ServerContext *context,
>>
>>                  const GetRequestMsg *req,
>>
>>                  GetResponseMsg *rsp)
>>
>> {
>>
>>     uint32_t    i, nreqs = req->request_size();
>>
>>
>>     for (i = 0; i < nreqs; i++) {
>>
>>         auto request = req->request(i);
>>
>>         get(request, rsp->add_response());
>>
>>     }
>>
>>
>>     return Status::OK;
>>
>> }
>>
>>
>> Obviously with the size of each response and the number of responses I 
>> expect a lot of memory usage but thought the memory should be recovered 
>> after this command is run. But this memory is never recovered and I rapidly 
>> run out of memory and my process crashes. 
>>
>>
>> I enabled usage of Arena in the proto file but that didn't change 
>> anything. Is there anything I need to add to free up the memory used after 
>> the CLI command is run? 
>>
>>
>> I am a newbie to gRPC so am sorry if I have missed out on anything 
>> simple! Any help is appreciated.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/0084261e-945b-4b41-b57b-49f6aa174482%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to