You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 ,
class InferInput {
public:
/// Create a InferInput instance that describes a model input.
/// \param infer_input Returns a new InferInput object.
/// \param name The name of input whose data will be described by this object.
/// \param dims The shape of the input.
/// \param datatype The datatype of the input.
/// \return Error object indicating success or failure.
static Error Create(
InferInput** infer_input, const std::string& name,
const std::vector<int64_t>& dims, const std::string& datatype);
};
class InferInput {
public:
/// Create a InferInput instance that describes a model input.
/// \param infer_input Returns a new InferInput object.
/// \param kind The kind of the associated client backend.
/// \param name The name of input whose data will be described by this object.
/// \param dims The shape of the input.
/// \param datatype The datatype of the input.
/// \return Error object indicating success or failure.
static Error Create(
InferInput** infer_input, const BackendKind kind, const std::string& name,
const std::vector<int64_t>& dims, const std::string& datatype);
virtual ~InferInput() = default;
};
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
Handle the memory deallocation for raw pointer using delete or else use smart pointer.
The text was updated successfully, but these errors were encountered:
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: