Hi WebKittens,

I recently saw several `make_unique<builtin[]>(num)` code.
This is good if we know that we do not extend this array dynamically.
However, be careful for the type of this... Otherwise, we bypass bmalloc
and go to slow system malloc!
For example, `make_unique<char[]>(num)` will allocate buffer from system
malloc.

If you use `std::make_unique<XXX[]>(num)` and XXX uses
WTF_MAKE_FAST_ALLOCATED, it is OK since it has new[]/delete[] operators.

I think one way to alleviate this issue is just using MallocPtr.
Personally, I would like to use make_unique, but it does not accept
allocator for std::unique_ptr<char[], XXX>'s XXX.

Please correct me if I'm wrong.

Best regards,
Yusuke Suzuki
_______________________________________________
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev

Reply via email to