- Cleaned up disposal in LLamaContext
- sealed some classes not intended to be extended
This commit is contained in:
parent
4d741d24f2
commit
d0a7a8fcd6
|
@ -422,6 +422,8 @@ namespace LLama
|
|||
/// <inheritdoc />
|
||||
public virtual void Dispose()
|
||||
{
|
||||
GC.SuppressFinalize(this);
|
||||
|
||||
_ctx.Dispose();
|
||||
}
|
||||
|
||||
|
@ -429,12 +431,11 @@ namespace LLama
|
|||
/// The state of this model, which can be reloaded later
|
||||
/// </summary>
|
||||
public class State
|
||||
: SafeHandleZeroOrMinusOneIsInvalid
|
||||
: SafeLLamaHandleBase
|
||||
{
|
||||
internal State(IntPtr memory)
|
||||
: base(true)
|
||||
: base(memory)
|
||||
{
|
||||
SetHandle(memory);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace LLama
|
|||
/// <summary>
|
||||
/// A set of model weights, loaded into memory.
|
||||
/// </summary>
|
||||
public class LLamaWeights
|
||||
public sealed class LLamaWeights
|
||||
: IDisposable
|
||||
{
|
||||
private readonly SafeLlamaModelHandle _weights;
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace LLama.Native
|
|||
/// <summary>
|
||||
/// A safe wrapper around a llama_context
|
||||
/// </summary>
|
||||
public class SafeLLamaContextHandle
|
||||
public sealed class SafeLLamaContextHandle
|
||||
: SafeLLamaHandleBase
|
||||
{
|
||||
#region properties and fields
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace LLama.Native
|
|||
/// <summary>
|
||||
/// A reference to a set of llama model weights
|
||||
/// </summary>
|
||||
public class SafeLlamaModelHandle
|
||||
public sealed class SafeLlamaModelHandle
|
||||
: SafeLLamaHandleBase
|
||||
{
|
||||
/// <summary>
|
||||
|
|
Loading…
Reference in New Issue