Skip to content

src: refacor `MallocedBuffer` to it's usage scope

As discussed in https://github.com/nodejs/node/pull/23543#pullrequestreview-164467022. MallocedBuffer is an unknown quantity as compared to std::unique_ptr.

  1. MallocedBuffer is a new utility and is node specific, so it's semantics are not clear to me, so I assume to others as well.
    • It's maturity is unknown (Ref: #23434)
    • It's ambiguous if MallocedBuffer::size is in units of T or number of byte
  2. std::unique_ptr is free of runtime cost (except for its dtor), while MallocedBuffer at minimum carries the runtime cost of construction, and the memory cost of MallocedBuffer::size.
  3. And probably most important to me - readability. std::unique_ptr is standardized and well documented. MallocedBuffer is only documented by its code.
  4. While refactoring is seems like it has no unit test coverage.

Ref: https://github.com/nodejs/node/pull/23543#pullrequestreview-164467022 Ref: https://github.com/nodejs/node/pull/23434

CI: https://ci.nodejs.org/job/node-test-pull-request/1​78​21

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

Merge request reports

Loading