-
Notifications
You must be signed in to change notification settings - Fork 234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Potential memory leak #791
Comments
I encountered a memory leak issue when using the Triton gRPC client. I tried using smart pointers to manage the raw pointer inputs and outputs, and I also initialize the gRPC client, input, and outputs only once in the constructor. However, the memory leak issue still persists. After each gRPC request, the memory increases. If you have any solutions, please help me. Thank you! std::unique_ptrtriton::client::InferenceServerGrpcClient mGrpcClient; triton::client::Error err = triton::client::InferenceServerGrpcClient::Create(&mGrpcClient, url, false); std::vector<int64_t> shape = {mBatchSize, mInputW, mInputH, mChannel}; triton::client::InferInput *input0; triton::client::InferRequestedOutput *output0; triton::client::InferRequestedOutput *output1; triton::client::InferRequestedOutput *output2; |
@nthung11cist, try to narrow down the approach to find memory leak. First only try
for every request and see if memory leak is from mGrpcClient. If not then create one input and see if you get memory leak.
|
Description
I am leveraging Triton Inference Server r24.07.
While trying to analyse the code , I see some potential memory leak for the some of the below file ,
1.common.cc
2.common.cc
3.torchserve_infer_input.cc
4.torchserve_http_client.cc
5.openai_infer_input.cc
6.grpc_client.cc
7.grpc_client.cc
I think here not handle the memory deallocation, it’s directly passing the raw pointer .
Consider one example :
common.cc
InferInput** infer_input is pointer to a pointer (i.e., a raw pointer). It holds the address of a pointer to InferInput
Here its create the “create” method as a static .
common.h
client_backend.h
For the above code I have understand that ,
this class designed in factory design pattern function but still since passing raw pointer ,if caller's or user as forgot handle the memory deallocation it leads to memory leak.
Solution is:
Use while creating “create“ method parameter for smart pointer or handle the memory deallocation in the raw pointer .
Handel the raw pointer deallocation using delete.
Triton Information r24.07
The code designed such way that as per the requirement user need to handle the memory .Is it documented for any user guide?
Expected behaviour
The text was updated successfully, but these errors were encountered: