Merge pull request #177 from redthing1/fix/context-getstate
fix opaque GetState (fixes #176)
This commit is contained in:
commit
79fa74d59c
|
@ -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…
Reference in New Issue