internal static void RecordLeakNonRefCountingOperation(IResourceLeakTracker leak) { if (!AcquireAndReleaseOnly) { leak.Record(); } }
internal SimpleLeakAwareCompositeByteBuffer(CompositeByteBuffer wrapped, IResourceLeakTracker leak) : base(wrapped) { if (leak is null) { ThrowHelper.ThrowArgumentNullException(ExceptionArgument.leak); } Leak = leak; }
internal SimpleLeakAwareByteBuffer(IByteBuffer wrapped, IByteBuffer trackedByteBuf, IResourceLeakTracker leak) : base(wrapped) { Contract.Requires(trackedByteBuf != null); Contract.Requires(leak != null); this.trackedByteBuf = trackedByteBuf; this.Leak = leak; }
internal SimpleLeakAwareByteBuffer(IByteBuffer wrapped, IByteBuffer trackedByteBuf, IResourceLeakTracker leak) : base(wrapped) { if (trackedByteBuf is null) { ThrowHelper.ThrowArgumentNullException(ExceptionArgument.trackedByteBuf); } if (leak is null) { ThrowHelper.ThrowArgumentNullException(ExceptionArgument.leak); } _trackedByteBuf = trackedByteBuf; Leak = leak; }
IByteBuffer UnwrappedDerived(IByteBuffer derived) { if (derived is AbstractPooledDerivedByteBuffer buffer) { // Update the parent to point to this buffer so we correctly close the ResourceLeakTracker. buffer.Parent(this); IResourceLeakTracker newLeak = AbstractByteBuffer.LeakDetector.Track(buffer); if (newLeak == null) { // No leak detection, just return the derived buffer. return(derived); } return(this.NewLeakAwareByteBuffer(buffer, newLeak)); } return(this.NewSharedLeakAwareByteBuffer(derived)); }
internal void Report(IResourceLeakTracker resourceLeak) { string records = resourceLeak.ToString(); if (this.reportedLeaks.TryAdd(records, true)) { if (records.Length == 0) { Logger.Error("LEAK: {}.Release() was not called before it's garbage-collected. " + "Enable advanced leak reporting to find out where the leak occurred. " + "To enable advanced leak reporting, " + "set environment variable {} to {} or set {}.Level in code. " + "See http://netty.io/wiki/reference-counted-objects.html for more information.", this.resourceType, PropLevel, DetectionLevel.Advanced.ToString().ToLowerInvariant(), StringUtil.SimpleClassName(this)); } else { Logger.Error( "LEAK: {}.release() was not called before it's garbage-collected. " + "See http://netty.io/wiki/reference-counted-objects.html for more information.{}", this.resourceType, records); } } }
protected virtual SimpleLeakAwareByteBuffer NewLeakAwareByteBuffer(IByteBuffer wrapped, IByteBuffer trackedByteBuf, IResourceLeakTracker leakTracker) => new SimpleLeakAwareByteBuffer(wrapped, trackedByteBuf, leakTracker);
internal SimpleLeakAwareCompositeByteBuffer(CompositeByteBuffer wrapped, IResourceLeakTracker leak) : base(wrapped) { Contract.Requires(leak != null); this.Leak = leak; }
protected virtual IByteBuffer Wrap(CompositeByteBuffer buffer, IResourceLeakTracker tracker) => new SimpleLeakAwareCompositeByteBuffer(buffer, tracker);
internal virtual IByteBuffer Wrap(IByteBuffer buffer, IResourceLeakTracker tracker) => new SimpleLeakAwareByteBuffer(buffer, tracker);
internal SimpleLeakAwareByteBuffer(IByteBuffer wrapped, IResourceLeakTracker leak) : this(wrapped, wrapped, leak) { }
SimpleLeakAwareByteBuffer NewLeakAwareByteBuffer(IByteBuffer wrapped, IResourceLeakTracker leakTracker) => this.NewLeakAwareByteBuffer(wrapped, wrapped, leakTracker);
protected AbstractDnsMessage(int id, DnsOpCode opcode) { Id = id; OpCode = opcode; leak = leakDetector.Track(this); }
internal override IByteBuffer Wrap(CompositeByteBuffer buffer, IResourceLeakTracker tracker) => new AdvancedLeakAwareCompositeByteBuffer(buffer, tracker);
internal AdvancedLeakAwareByteBuffer(IByteBuffer buf, IResourceLeakTracker leak) : base(buf, leak) { }
internal AdvancedLeakAwareByteBuffer(IByteBuffer wrapped, IByteBuffer trackedByteBuf, IResourceLeakTracker leak) : base(wrapped, trackedByteBuf, leak) { }
internal AdvancedLeakAwareCompositeByteBuffer(CompositeByteBuffer wrapped, IResourceLeakTracker leak) : base(wrapped, leak) { }
protected override SimpleLeakAwareByteBuffer NewLeakAwareByteBuffer(IByteBuffer buf, IByteBuffer trackedByteBuf, IResourceLeakTracker leakTracker) => new AdvancedLeakAwareByteBuffer(buf, trackedByteBuf, leakTracker);
protected override IByteBuffer Wrap(IByteBuffer buffer, IResourceLeakTracker tracker) => new AdvancedLeakAwareByteBuffer(buffer, tracker);