Fixed in r271487. On Wed, Jun 1, 2016 at 10:56 PM, Eric Fiselier <e...@efcs.ca> wrote:
> Nevermind my last comment. It's just a bug in my implementation. Thanks > again for catching it. > > On Wed, Jun 1, 2016 at 10:40 PM, Eric Fiselier <e...@efcs.ca> wrote: > >> Oh goodness your right. There are a bunch of bugs in the shared_ptr >> constructors/destructors use both the specified deleters and allocators. >> >> Thanks for pointing out my stupidity! >> >> On Wed, Jun 1, 2016 at 10:25 PM, Arthur O'Dwyer < >> arthur.j.odw...@gmail.com> wrote: >> >>> On Wed, Jun 1, 2016 at 7:00 PM, Eric Fiselier <e...@efcs.ca> wrote: >>> >>>> No the leak was my fault. The sneaky line was "std::shared_ptr<T> >>>> s(ptr, &nullDeleter);", which caused the allocation of a shared control >>>> block. >>>> >>> >>> But surely the control block is allocated and deallocated by libc++ >>> behind the scenes, foolproofly? >>> >>> >>>> Since the deleter is a NOP it gets leaked and ASAN reports it. >>>> >>> >>> Surely the NOP deleter applies only to the controlled object *ptr, not >>> to the control block? Is the supplied deleter actually used to >>> allocate/deallocate the control block as well? >>> >>> The controlled object *ptr is explicitly delete'd at the end of the test >>> case, which is why it seems safe to me. >>> >>> –Arthur >>> >>> >>> On Jun 1, 2016 6:15 PM, "Eric Fiselier via cfe-commits" < >>> cfe-commits@lists.llvm.org> wrote: >>> >>>> Author: ericwf >>>>>> Date: Wed Jun 1 20:09:12 2016 >>>>>> New Revision: 271459 >>>>>> >>>>>> URL: http://llvm.org/viewvc/llvm-project?rev=271459&view=rev >>>>>> Log: >>>>>> Remove enable_shared_from_this test since it leaks the control block >>>>>> and fails with ASAN >>>>>> >>>>>> Modified: >>>>>> >>>>>> libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp >>>>>> >>>>>> Modified: >>>>>> libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp >>>>>> URL: >>>>>> http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp?rev=271459&r1=271458&r2=271459&view=diff >>>>>> >>>>>> ============================================================================== >>>>>> --- >>>>>> libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp >>>>>> (original) >>>>>> +++ >>>>>> libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp >>>>>> Wed Jun 1 20:09:12 2016 >>>>>> @@ -88,32 +88,6 @@ int main() >>>>>> } >>>>>> #endif >>>>>> } >>>>>> - // Test LWG issue 2529 again. This time check that an expired >>>>>> pointer >>>>>> - // is replaced. >>>>>> - { >>>>>> - T* ptr = new T; >>>>>> - std::weak_ptr<T> weak; >>>>>> - { >>>>>> - std::shared_ptr<T> s(ptr, &nullDeleter); >>>>>> - assert(ptr->shared_from_this() == s); >>>>>> - weak = s; >>>>>> - assert(!weak.expired()); >>>>>> - } >>>>>> - assert(weak.expired()); >>>>>> - weak.reset(); >>>>>> -#ifndef TEST_HAS_NO_EXCEPTIONS >>>>>> - try { >>>>>> - ptr->shared_from_this(); >>>>>> - assert(false); >>>>>> - } catch (std::bad_weak_ptr const&) { >>>>>> - } catch (...) { assert(false); } >>>>>> -#endif >>>>>> - { >>>>>> - std::shared_ptr<T> s2(ptr, &nullDeleter); >>>>>> - assert(ptr->shared_from_this() == s2); >>>>>> - } >>>>>> - delete ptr; >>>>>> - } >>>>>> // Test weak_from_this_methods >>>>>> #if TEST_STD_VER > 14 >>>>>> { >>>>>> >>>>>> >>>>>> _______________________________________________ >>>>>> cfe-commits mailing list >>>>>> cfe-commits@lists.llvm.org >>>>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits >>>>>> >>>>> >>>> >>> >> >
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits