mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-16 09:50:40 +08:00
fix: intentionally leak onnxruntime objects to avoid crash
This should be reverted when it get fixed upstream
This commit is contained in:
@@ -98,3 +98,14 @@ bool asst::OnnxSessions::use_gpu(int device_id)
|
||||
gpu_enabled = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
asst::OnnxSessions::~OnnxSessions()
|
||||
{
|
||||
// FIXME: intentionally leak ort objects to avoid crash (double free?)
|
||||
// https://github.com/microsoft/onnxruntime/issues/15174
|
||||
auto leak_sessions = new decltype(m_sessions);
|
||||
*leak_sessions = std::move(m_sessions);
|
||||
|
||||
auto leak_options = new Ort::SessionOptions(nullptr);
|
||||
*leak_options = std::move(m_options);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace asst
|
||||
class OnnxSessions final : public SingletonHolder<OnnxSessions>, public AbstractResource
|
||||
{
|
||||
public:
|
||||
virtual ~OnnxSessions() override = default;
|
||||
virtual ~OnnxSessions();
|
||||
virtual bool load(const std::filesystem::path& path) override;
|
||||
|
||||
Ort::Session& get(const std::string& name);
|
||||
|
||||
Reference in New Issue
Block a user