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

Re: Why passing a pool to a printf?

From: Branko ÄŒibej <brane_at_xbc.nu>
Date: 2004-05-18 03:57:23 CEST

Nicolás Lichtmaier wrote:

> Why not creating and destroying a pool with each printf?

Because it allocates memory for argument interpolation and charser
conversion.

> Why cluttering the interface, requiring other functions to also
> include a pool?

Because in most places, a pool is already available. I suppose we could
make the pool parameter optional and have svn_cmdline_printf create its
own pool if it's NULL, but that would make this function inconsistent
with every other function in Subversion that creates a pool.

I don't think there are that many places where a pool is not already handy.

> And what about this:
>
> for(i=0 ; i<10000 ; i++)
> svn_cmdline_printf(pool, "file %s\n", files[i]);
>
> Won't this take lots of memory?

Oh fi. We have guidelines for that. See HACKING, section "APR pool usage
conventions".

-- Brane

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue May 18 03:59:30 2004

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

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