Controllers need to be careful about freeing input and output memory of InferRequest
(client), InferResponse
(client), Infer
(worker), and InferResult
(worker) in the following ways:
InferRequest
from client - the controller network code will allocate memory for input
. the controller needs to delete input
when doneInferResponse
to client - the controller network code assumes that your controller allocated memory for output
, and will delete output
after sending has completedInfer
to worker - the controller network code does not allocate or free any memory. you can safely set Infer::input = InferRequest::input
.InferResult
from worker - the controller network code will allocate memory for output
. you can safely set InferResponse::output = InferResult::output
InferRequest
then your controller will have to allocate memory for the batch. This means you need to pay attention to the following:Infer
- you will have to allocate memory for input
. You should wait until you receive an InferResult
before freeing the input
of the original Infer
.InferResponse
- you will have to allocate memory for each request's output
. As described above, this will be automatically deleted by the controller network code once the response has been sent to the clientInferResult
- after copying the batched output to each individual InferResponse
, you will need to free the InferResult::output
.