Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep arena config alive #941

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/generators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ namespace Generators {
static bool _ = (Ort::InitApi(), false);

OrtGlobals::OrtGlobals()
: env_{OrtEnv::Create(OrtLoggingLevel::ORT_LOGGING_LEVEL_ERROR)} {
auto arena_config = OrtArenaCfg::Create(0, -1, -1, -1);
: env_{OrtEnv::Create(OrtLoggingLevel::ORT_LOGGING_LEVEL_ERROR)},
arena_config_{OrtArenaCfg::Create(0, -1, -1, -1)} {
Ort::Allocator& allocator_cpu{Ort::Allocator::GetWithDefaultOptions()};
env_->CreateAndRegisterAllocator(allocator_cpu.GetInfo(), *arena_config);
env_->CreateAndRegisterAllocator(allocator_cpu.GetInfo(), *arena_config_);
}

// Ensure Shutdown() has been called before process exit
Expand Down
1 change: 1 addition & 0 deletions src/generators.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ struct OrtGlobals {
OrtGlobals();

std::unique_ptr<OrtEnv> env_;
std::unique_ptr<OrtArenaCfg> arena_config_;
#if USE_CUDA
std::unique_ptr<OrtMemoryInfo> memory_info_cuda_;
std::unique_ptr<Ort::Allocator> allocator_cuda_;
Expand Down
Loading