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

Re: Patch - leaking file handles and minor issues in ContextMenu

From: Dmitry <wipedout_at_yandex.ru>
Date: Wed, 26 Jan 2011 09:14:53 +0300

Hey.

> But I tweaked your patch a little bit: I'd like to declare buffers
> outside a loop since not all compilers are smart enough. Declaring them
> inside the loop can lead to repeated stack allocations/deallocations of
> the buffer for every loop run. Just to be safe here, I'd like to do that
> outside the loops.
Allocation/deallocation of TCHAR[] on stack is at most a single processor instruction (adjustment of "stack top" register), nothing more and most compilers will just allocate space for all stack variables of the function at once - one huge frame for all stuff. Also it is much more reliable if the buffer is reinitialized before each use - that's the number one reason I moved the definition into the loop body.

Best wishes.
Dmitry.

------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=757&dsMessageId=2700493

To unsubscribe from this discussion, e-mail: [dev-unsubscribe_at_tortoisesvn.tigris.org].
Received on 2011-01-26 07:15:00 CET

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