Hey.
06.09.11, 21:04, "Stefan Küng" <tortoisesvn_at_gmail.com>:
> >>> Currently it uses raw pointers and this is not exception-safe.
> >>> Also
> >> I don't quite see the problem here?
> > Well, if an exception is thrown between "new" and "delete" the latter
> > in not invoked and the object is leaked. That's why we have auto_ptr,
> > auto_buffer and a gazillion of other classes.
> Sure, but using auto_ptr or something similar only makes sense if we
> would actually catch the exception - but we don't. Instead, an exception
> would trigger the crash report dialog so the memory leak is not a problem.
That's not always true. Having "delete" not called leaks a live object, not just some memory. Which means that the object destructor is not run and that might change the program behavior. Also exceptions are not propagated to the top level all over Tortoise SVN - there're "catch" statements in many places, so even if there's no risk of accumulating leaks right now there's no guarantee that after some change much later you don't have code that leaks memory very badly. From my experience "natural selection" favors bad code - it is coped all over the codebase.
Best wishes.
Dmitry.
------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=757&dsMessageId=2836134
To unsubscribe from this discussion, e-mail: [dev-unsubscribe_at_tortoisesvn.tigris.org].
Received on 2011-09-07 13:15:31 CEST