0
IService service = MyGrpcChannel.CreateGrpcService<IService>();
long[] ids = service.GetIds();

Do I need to do something to close/destroy the IService when I finish to use it?

Bassie
  • 9,529
  • 8
  • 68
  • 159
Guilherme Molin
  • 308
  • 4
  • 13

1 Answers1

0

It's not necessary, the service is a thin veneer on the channel:

https://github.com/protobuf-net/protobuf-net.Grpc/issues/166

I also made a test creating 1 million services:

for(int i = 0; i <= 1000000; i++)
{
    MyGrpcChannel.CreateGrpcService<IService>().GetIds();
}

No memory leak on the task manager. At the start of execution it was using 100mb and at the end too.

Guilherme Molin
  • 308
  • 4
  • 13