Browse Source

Merge pull request #177 from redthing1/fix/context-getstate

fix opaque GetState (fixes #176)
tags/v0.6.0
Haiping GitHub 2 years ago
parent
commit
79fa74d59c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions
  1. +6
    -2
      LLama/LLamaContext.cs

+ 6
- 2
LLama/LLamaContext.cs View File

@@ -210,9 +210,13 @@ namespace LLama
// Shrink to size
memory = Marshal.ReAllocHGlobal(memory, (nint)actualSize);

// Wrap memory in a state and return it
// Wrap memory in a "state"
var state = new State(memory);

// Set memory to zero, to prevent it being freed in finally block
memory = IntPtr.Zero;
return new State(memory);

return state;
}
finally
{


Loading…
Cancel
Save