[Issue 2590] Deallocator is not called if constructor fails.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Apr 4 13:35:14 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=2590


Justin Spahr-Summers <Justin.SpahrSummers at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |Justin.SpahrSummers at gmail.c
                   |                            |om


--- Comment #3 from Justin Spahr-Summers <Justin.SpahrSummers at gmail.com> 2010-04-04 15:35:10 CDT ---
(In reply to comment #2)
> He is talking about constructors/destructors, not allocators/deallocators. I
> totally agree the destructor must not be called on a partially constructed
> object. Conversely, the memory that has been successfully allocated for an
> object needs to be properly deallocated even if the constructor fails.
> 
> On the other hand, if overloaded new/delete are going to be removed from the
> language, the problem will pass away.

When one uses class allocators/deallocators, it's basically like taking memory
management into one's own hands. The current behavior seems reasonable, because
'delete' is never invoked on the object (which is necessary for a custom
deallocator to be used).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list