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
I have a CNN server in my PC,when a lot of request coming in(memory usage increase) and after a while there is no request(momery not free)..And I use VS2019 performance profiler to analysis momery leak.Ort::Session:Run and onnxruntime.dll run out memory.
template<int YN, int XN>
void RefreshPredict(std::vector<std::array<float, YN>>& predict, const std::vector<std::array<float, XN>>& ins, int beginI, int endI) const {
std::vector<std::array<float, XN>>& nonConstIns = const_cast<std::vector<std::array<float, XN>>&>(ins);
assert(predict.size() == ins.size());
auto what_dims = input_node_dims;
what_dims[0] = endI - beginI;
if (what_dims[0] <= 0)
return;
assert(what_dims[0] >= 0);
auto memory_info = Ort::MemoryInfo::CreateCpu(OrtArenaAllocator, OrtMemTypeDefault);
Ort::Value input_tensor = Ort::Value::CreateTensor<float>(memory_info, nonConstIns[beginI].data(), XN * what_dims[0], what_dims.data(), what_dims.size());
assert(input_tensor.IsTensor());
std::vector<const char*> output_node_names;
output_node_names.resize(1);
output_node_names[0] = output_name.c_str();
auto output_tensors = session_->Run(Ort::RunOptions{ nullptr }, input_node_names.data(), &input_tensor, 1, output_node_names.data(), 1);
float* floatarr = output_tensors.front().GetTensorMutableData<float>();
float* pret = predict[beginI].data();
for (int i = 0; i < YN * what_dims[0]; i++) {
pret[i] = floatarr[i];
}
}
Is there a gc.collect function or I use this lib in a wrong way?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have a CNN server in my PC,when a lot of request coming in(memory usage increase) and after a while there is no request(momery not free)..And I use VS2019 performance profiler to analysis momery leak.Ort::Session:Run and onnxruntime.dll run out memory.
Is there a gc.collect function or I use this lib in a wrong way?
Beta Was this translation helpful? Give feedback.
All reactions