Skip to content

Commit

Permalink
Link to PR from allocUnsafe comment
Browse files Browse the repository at this point in the history
  • Loading branch information
cressie176 committed Aug 7, 2022
1 parent 92a7cdd commit c6490d4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/connection.js
Expand Up @@ -563,6 +563,7 @@ C.sendMessage = function(channel,
// Use `allocUnsafe` to avoid excessive allocations and CPU usage
// from zeroing. The returned Buffer is not zeroed and so must be
// completely filled to be used safely.
// See https://github.com/amqp-node/amqplib/pull/695
var all = Buffer.allocUnsafe(allLen);
var offset = mframe.copy(all, 0);
offset += pframe.copy(all, offset);
Expand All @@ -576,6 +577,7 @@ C.sendMessage = function(channel,
// Use `allocUnsafe` to avoid excessive allocations and CPU usage
// from zeroing. The returned Buffer is not zeroed and so must be
// completely filled to be used safely.
// See https://github.com/amqp-node/amqplib/pull/695
var both = Buffer.allocUnsafe(methodHeaderLen);
var offset = mframe.copy(both, 0);
pframe.copy(both, offset);
Expand Down

0 comments on commit c6490d4

Please sign in to comment.