Skip to content

Commit 26bb8f7

Browse files
authored
Merge pull request #1603 from bollhals/fix/allocation
fix some quick wins
2 parents 299ccda + a11ee72 commit 26bb8f7

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

projects/RabbitMQ.Client/client/RentedMemory.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,23 +68,17 @@ internal readonly ReadOnlyMemory<byte> CopyToMemory()
6868
return new ReadOnlyMemory<byte>(Memory.ToArray());
6969
}
7070

71-
private void Dispose(bool disposing)
71+
public void Dispose()
7272
{
7373
if (!_disposedValue)
7474
{
75-
if (disposing && RentedArray != null)
75+
if (RentedArray != null)
7676
{
7777
ArrayPool<byte>.Shared.Return(RentedArray);
7878
}
7979

8080
_disposedValue = true;
8181
}
8282
}
83-
84-
public void Dispose()
85-
{
86-
Dispose(disposing: true);
87-
GC.SuppressFinalize(this);
88-
}
8983
}
9084
}

projects/RabbitMQ.Client/client/impl/ChannelBase.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,10 +1069,7 @@ await _confirmSemaphore.WaitAsync(cancellationToken)
10691069

10701070
try
10711071
{
1072-
var cmd = new BasicPublishMemory(
1073-
Encoding.UTF8.GetBytes(exchange),
1074-
Encoding.UTF8.GetBytes(routingKey),
1075-
mandatory, default);
1072+
var cmd = new BasicPublish(exchange, routingKey, mandatory, default);
10761073
using Activity sendActivity = RabbitMQActivitySource.PublisherHasListeners
10771074
? RabbitMQActivitySource.Send(routingKey, exchange, body.Length)
10781075
: default;

0 commit comments

Comments
 (0)