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.