Memory leak in C++?

563 views
Skip to first unread message

HYU

unread,
Jun 18, 2015, 12:57:56 PM6/18/15
to grp...@googlegroups.com
Hi there, 

I was testing gRPC for inter process communication. I used the helloWorld example as a test case on Windows using VS 2013 Express. The helloWorld sever code remains unchanged. The Original .proto file were used as well. 

Here's my modification(bolded) to the main function in the original helloWorld client. 

int main(int argc, char** argv) {
  GreeterClient greeter(
      grpc::CreateChannel("localhost:50051", grpc::InsecureCredentials(),
                          ChannelArguments()));
  std::string user("world");
  for (int i = 0; i < 100000; ++i)
  {
 std::string reply = greeter.SayHello(user);
 std::cout << "Greeter received: " << reply << std::endl;
  }
  return 0;
}

Basically I am sending request at a very high frequency. I then used windows task manager to monitor my physical memory usage, and I can see that the memory used were increasing linearly with time. And half of those used memory is freeed when I close my client process, the other half is freed when I closed my sever process.

My question is, Am I using gRPC correctly? Is there a way to free those memories? Is it a memory leak or whatever?

Thanks in advance!

Best,
HYu  

Jan Tattermusch

unread,
Jun 18, 2015, 1:14:53 PM6/18/15
to HYU, grp...@googlegroups.com
Hi,

I believe this might be connected to issue https://github.com/grpc/grpc/issues/1841.

--
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 grpc-io+u...@googlegroups.com.
To post to this group, send email to grp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/33fa3eb4-d242-497e-8a67-c4458811e96f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

HYU

unread,
Jun 18, 2015, 1:46:33 PM6/18/15
to grp...@googlegroups.com, yuhan...@gmail.com
Thanks Jan,

Yeah, I think I had the same issue and thanks for your help, I think I will wait until this issue is resolved. I wished I could help, but it's a bit too much for me...

Best,
HYu

Jan Tattermusch

unread,
Jun 18, 2015, 2:38:27 PM6/18/15
to HYU, grp...@googlegroups.com
Hi Hang,

please check if the patch from https://github.com/grpc/grpc/pull/2125 fixes your problem.

HYU

unread,
Jun 18, 2015, 3:26:16 PM6/18/15
to grp...@googlegroups.com, yuhan...@gmail.com
Cool, thanks a lot for your help, I will give it a try later today and will let you know if it works.

alvaro...@gmail.com

unread,
Jul 6, 2015, 3:28:20 AM7/6/15
to grp...@googlegroups.com
Well I have tried this fix, but haven't found a way to overcome the issue. Can you better explain how this fix works?

I also opened a bug where I show the issue on how memory is increasing and in witch steps, to try to help to debug it but haven't got any answer.

Reply all
Reply to author
Forward
0 new messages