- Initial commit

This commit is contained in:
Timur Kozanov
2026-07-03 05:02:26 +03:00
commit 374ff1e689
4080 changed files with 388870 additions and 0 deletions

View File

@ -0,0 +1,37 @@
#if BESTHTTP_ENABLE_BUFFERPOOL_BORROW_CHECKER
using Best.HTTP.Shared.Logger;
using System;
namespace Best.HTTP.Shared.PlatformSupport.Memory
{
public sealed class Tracker : IDisposable
{
public string Stack => this._stack;
public LoggingContext Context => this._context;
private readonly string _stack;
private readonly LoggingContext _context;
private bool _disposed;
public Tracker(LoggingContext context)
{
this._stack = BufferPool.ProcessStackTrace(Environment.StackTrace);
this._context = context;
}
public void Dispose()
{
_disposed = true;
GC.SuppressFinalize(this);
}
~Tracker()
{
if (!_disposed && !Environment.HasShutdownStarted)
HTTPManager.Logger.Error("BufferPool", $"Buffer Leaked! Borrowed at: {_stack}", this._context);
}
}
}
#endif