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

Re: [PATCH] Don't ignore multiple --target switches

From: Hyrum K. Wright <hyrum_wright_at_mail.utexas.edu>
Date: 2006-05-31 23:51:07 CEST

C. Michael Pilato wrote:
> Hyrum K. Wright wrote:
>> C. Michael Pilato wrote:
>>
>>> Having trouble typing clearly today, it seems...
>>>
>>> C. Michael Pilato wrote:
>>>
>>>> Hyrum K. Wright wrote:
>>>>
>>>>
>>>>> This patch fixes a bug where multiple --target switches fail silently
>>>>> for all but the final one. Instead, this patch concatenates all targets
>>>>> specified by multiple --target switches into one array.
>>>>>
>>>>> Coincidentally, this patch also fixes a memory leak, since we were just
>>>>> dropping the previous list of targets when we encountered additional
>>>>> --target switches.
>>>> Eh, we're still leaking memory with this patch because apr_array_append()
>>>> doesn't reuse either of the arrays it's given as input. So it takes array A
>>>> and B and makes a new C (wasting both A and B). If a third --targets comes
>>>> along, it'll waste another pair of arrays. And so on. But we're only
>>>> talking about an amount of memory proportional to the number of times
>>>> --targets shows up as an option, and not alot of memory at that.
>>> To clarify, it only wastes the memory needed for the array structure, not
>>> its elements.
>>
>> Understood. Is this type of waste acceptable, or would the ideal
>> solution be to make sure we clean up after ourselves by using a subpool?
>
> Because of the low cost here, I'd personally just drop a little comment
> saying, "Hey, we're wasting a handful of bytes (the size of an array header)
> here to avoid the overhead and complexity of a subpool."

Okay. Attached is a second version of the patch.

-Hyrum

[[[
Allow the --targets switch to be given multiple times.

* subversion/svn/main.c
  (main): Append multiple targets to the same array, instead of
          replacing them.
]]]

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Received on Wed May 31 23:51:41 2006

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