Skip to content

Commit

Permalink
Change field order to drop Environment last
Browse files Browse the repository at this point in the history
  • Loading branch information
acrrd committed Oct 23, 2023
1 parent 5133e37 commit 4c9e861
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,15 @@ use crate::{io_binding::IoBinding, value::Value};
/// # }
/// ```
pub struct SessionBuilder {
env: Arc<Environment>,
session_options_ptr: *mut sys::OrtSessionOptions,

allocator: AllocatorType,
memory_type: MemType,
custom_runtime_handles: Vec<*mut std::os::raw::c_void>,
execution_providers: Vec<ExecutionProvider>
execution_providers: Vec<ExecutionProvider>,

// env must be last to drop it after everything else
env: Arc<Environment>
}

impl Debug for SessionBuilder {
Expand Down Expand Up @@ -566,14 +568,16 @@ impl Drop for SessionPointerHolder {
/// Type storing the session information, built from an [`Environment`](crate::environment::Environment)
#[derive(Debug)]
pub struct Session {
#[allow(dead_code)]
env: Arc<Environment>,
pub(crate) session_ptr: Arc<SessionPointerHolder>,
allocator_ptr: *mut sys::OrtAllocator,
/// Information about the ONNX's inputs as stored in loaded file
pub inputs: Vec<Input>,
/// Information about the ONNX's outputs as stored in loaded file
pub outputs: Vec<Output>
pub outputs: Vec<Output>,

// env must be last to drop it after everything else
#[allow(dead_code)]
env: Arc<Environment>
}

/// A [`Session`] with data stored in-memory.
Expand Down

0 comments on commit 4c9e861

Please sign in to comment.