[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: Stefan Küng <tortoisesvn_at_gmail.com>
Date: Wed, 26 Jan 2011 20:13:15 +0100

On 26.01.2011 07:14, Dmitry wrote:
> 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.

Not all compilers are so effective. I have used many compilers for
microcontrollers which are really terrible in that respect.

> 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.

Error checking the DragQueryFile call is better here anyway:
see r20770.

Stefan

-- 
        ___
   oo  // \\      "De Chelonian Mobile"
  (_,\/ \_/ \     TortoiseSVN
    \ \_/_\_/>    The coolest Interface to (Sub)Version Control
    /_/   \_\     http://tortoisesvn.net
------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=757&dsMessageId=2700669
To unsubscribe from this discussion, e-mail: [dev-unsubscribe_at_tortoisesvn.tigris.org].
Received on 2011-01-26 20:13:41 CET

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.