tcmalloc-rs icon indicating copy to clipboard operation
tcmalloc-rs copied to clipboard

Clarify why this crate doesn't use tc_free_sized

Open jmcomets opened this issue 1 year ago • 0 comments

There's an unclear comment here that doesn't explain why tc_free_sized isn't used.

The issue is well explained over at https://github.com/gperftools/gperftools/issues/1096#issuecomment-480629732.

Summary:

  • it's less a bug from TCMalloc and more of a missed assumption that sized free can always be used
  • performance-wise there should be no noticeable impact (outside of micro-benchmarks)

Additionally, the upgrade to C++14 brought aligned new, which would be more correct to use; however under the hood both are implemented the same way (see the impl for memalign and tc_new_aligned), the only difference being one failing the C-fashion and the other the C++-fashion.

I'll leave this open as a small internal docs issue since there's not much required.

jmcomets avatar Nov 08 '24 18:11 jmcomets