Skip to content

Commit 9125616

Browse files
committed
fix custom_allocator_ destruction order
1 parent 4959468 commit 9125616

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

onnxruntime/test/perftest/ort_test_session.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,10 @@ class OnnxRuntimeTestSession : public TestSession {
3737
Ort::Session session_{nullptr};
3838
std::mt19937 rand_engine_;
3939
std::uniform_int_distribution<int> dist_;
40-
std::vector<std::vector<Ort::Value>> test_inputs_;
4140
OrtAllocator* allocator_ = Ort::AllocatorWithDefaultOptions();
41+
// Note: custom_allocator_, if used, must outlive the `Ort::Value`s allocated with it in test_inputs_ and outputs_.
4242
Ort::Allocator custom_allocator_{nullptr};
43+
std::vector<std::vector<Ort::Value>> test_inputs_;
4344
std::vector<Ort::Value> outputs_;
4445
std::vector<std::string> output_names_;
4546
// The same size with output_names_.

0 commit comments

Comments
 (0)