[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: r21936 is damn suspicious

From: Dmitry <wipedout_at_yandex.ru>
Date: Wed, 07 Sep 2011 15:15:26 +0400

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

This is an archived mail posted to the TortoiseSVN Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.