mirror of
https://github.com/scylladb/scylladb.git
synced 2026-06-02 04:56:58 +00:00
deleter::share() is causing massive amounts of allocation. First, since usually a packet's deleter is not a shared_deleter, we need to allocate that shared_deleter. Second, we need an external reference count which requires yet another allocation. Making reference counting part of the deleter class would solve both of these problems, but we cannot easily do that, since users hold std::unique_ptr<deleter> which is clearly not sharable. We could do a massive s/unique_ptr/shared_ptr/ here, but that would have the side effect of making sharing "too easy" - you simply copy the pointer. We'd like to keep it explicit. So to make the change easier, rename the existing unique_ptr<deleter> as plain "deleter", whereas the old "deleter" becomes deleter::impl: old name new name -------- -------- deleter deleter::impl unique_ptr<deleter> deleter with exactly the same semantics. A later patch can then add explicit sharing.