|  | @@ -232,13 +232,13 @@ class CommonStressTestSyncServer : public CommonStressTest<TestServiceImpl> {
 | 
	
		
			
				|  |  |  class CommonStressTestAsyncServer
 | 
	
		
			
				|  |  |      : public CommonStressTest<grpc::testing::EchoTestService::AsyncService> {
 | 
	
		
			
				|  |  |   public:
 | 
	
		
			
				|  |  | +  CommonStressTestAsyncServer() : contexts_(kNumAsyncServerThreads * 100) {}
 | 
	
		
			
				|  |  |    void SetUp() override {
 | 
	
		
			
				|  |  |      shutting_down_ = false;
 | 
	
		
			
				|  |  |      ServerBuilder builder;
 | 
	
		
			
				|  |  |      SetUpStart(&builder, &service_);
 | 
	
		
			
				|  |  |      cq_ = builder.AddCompletionQueue();
 | 
	
		
			
				|  |  |      SetUpEnd(&builder);
 | 
	
		
			
				|  |  | -    contexts_ = new Context[kNumAsyncServerThreads * 100];
 | 
	
		
			
				|  |  |      for (int i = 0; i < kNumAsyncServerThreads * 100; i++) {
 | 
	
		
			
				|  |  |        RefreshContext(i);
 | 
	
		
			
				|  |  |      }
 | 
	
	
		
			
				|  | @@ -265,7 +265,6 @@ class CommonStressTestAsyncServer
 | 
	
		
			
				|  |  |      while (cq_->Next(&ignored_tag, &ignored_ok))
 | 
	
		
			
				|  |  |        ;
 | 
	
		
			
				|  |  |      TearDownEnd();
 | 
	
		
			
				|  |  | -    delete[] contexts_;
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |   private:
 | 
	
	
		
			
				|  | @@ -311,7 +310,8 @@ class CommonStressTestAsyncServer
 | 
	
		
			
				|  |  |          response_writer;
 | 
	
		
			
				|  |  |      EchoRequest recv_request;
 | 
	
		
			
				|  |  |      enum { READY, DONE } state;
 | 
	
		
			
				|  |  | -  } * contexts_;
 | 
	
		
			
				|  |  | +  };
 | 
	
		
			
				|  |  | +  std::vector<Context> contexts_;
 | 
	
		
			
				|  |  |    ::grpc::testing::EchoTestService::AsyncService service_;
 | 
	
		
			
				|  |  |    std::unique_ptr<ServerCompletionQueue> cq_;
 | 
	
		
			
				|  |  |    bool shutting_down_;
 | 
	
	
		
			
				|  | @@ -353,14 +353,12 @@ typedef ::testing::Types<CommonStressTestSyncServer,
 | 
	
		
			
				|  |  |  TYPED_TEST_CASE(End2endTest, CommonTypes);
 | 
	
		
			
				|  |  |  TYPED_TEST(End2endTest, ThreadStress) {
 | 
	
		
			
				|  |  |    this->common_.ResetStub();
 | 
	
		
			
				|  |  | -  std::vector<std::thread*> threads;
 | 
	
		
			
				|  |  | +  std::vector<std::thread> threads;
 | 
	
		
			
				|  |  |    for (int i = 0; i < kNumThreads; ++i) {
 | 
	
		
			
				|  |  | -    threads.push_back(
 | 
	
		
			
				|  |  | -        new std::thread(SendRpc, this->common_.GetStub(), kNumRpcs));
 | 
	
		
			
				|  |  | +    threads.emplace_back(SendRpc, this->common_.GetStub(), kNumRpcs);
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |    for (int i = 0; i < kNumThreads; ++i) {
 | 
	
		
			
				|  |  | -    threads[i]->join();
 | 
	
		
			
				|  |  | -    delete threads[i];
 | 
	
		
			
				|  |  | +    threads[i].join();
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 |