cyrusbehr / tensorrt-cpp-api

TensorRT C++ API Tutorial
MIT License
543 stars 66 forks source link

resource leak, fstream is not closed. #55

Closed GarryLau closed 2 months ago

GarryLau commented 2 months ago

In function "bool Engine::build(std::string onnxModelPath, const std::array<float, 3> &subVals, const std::array<float, 3> &divVals, bool normalize) " the file stream "std::ifstream file" and "std::ofstream outfile" not closed.

cyrusbehr commented 2 months ago

The files handles are automatically closed in the destructor for those classes. https://stackoverflow.com/a/748059

GarryLau commented 2 months ago

The files handles are automatically closed in the destructor for those classes. https://stackoverflow.com/a/748059

Many thanks, one more thing I've learned from you.