Prevent OOM

This commit is contained in:
2026-06-18 05:55:31 +10:00
parent ebba70b9d9
commit b3436a61ee
44 changed files with 1797 additions and 66 deletions
+11 -3
View File
@@ -141,7 +141,7 @@ namespace ANSCENTER {
{
try {
// Make sure the Ort API pointer is initialised in THIS DLL.
if (Ort::Global<void>::api_ == nullptr) {
if (Ort::detail::Global::Api() == nullptr) {
Ort::InitApi(static_cast<const OrtApi*>(EPLoader::GetOrtApiRaw()));
}
@@ -574,10 +574,10 @@ namespace ANSCENTER {
const auto& epInfo = EPLoader::Current();
ANS_DBG("OrtHandler", "initialize_handler: EPLoader type=%d dir=%s",
static_cast<int>(epInfo.type), epInfo.libraryDir.c_str());
if (Ort::Global<void>::api_ == nullptr)
if (Ort::detail::Global::Api() == nullptr)
Ort::InitApi(static_cast<const OrtApi*>(EPLoader::GetOrtApiRaw()));
std::cout << "[ORT] api_ = " << (void*)Ort::Global<void>::api_ << std::endl;
std::cout << "[ORT] api_ = " << (void*)Ort::detail::Global::Api() << std::endl;
EngineType engine = (static_cast<int>(m_engineType) == -1)
? epInfo.type : m_engineType;
@@ -1900,4 +1900,12 @@ namespace ANSCENTER {
return std::fabs(width() * height());
}
// Explicit instantiations of every BoundingBoxType member must live
// AFTER the template definitions above so the compiler actually emits
// symbols (the directives in ONNXEngine.h sit before the definitions
// and ClangCL, unlike MSVC, refuses to emit symbols from there).
template struct ANSCENTER::types::BoundingBoxType<int, float>;
template struct ANSCENTER::types::BoundingBoxType<float, float>;
template struct ANSCENTER::types::BoundingBoxType<double, double>;
} // namespace ANSCENTER