(which doesn't allocate memory).

>>>>>>>>>>>>>>

That's not true.
Check this out..

shared_count.hpp

    template<class P, class D>
    shared_count( P p, D d ): pi_(0)
    {
        try
        {
            pi_ = new sp_counted_impl_pd<P, D>(p, d);
        }
        catch(...)
        {
            d(p); // delete p
            throw;
        }
    }

That's what causes the leak.