[prev in list] [next in list] [prev in thread] [next in thread] 

List:       apache-httpd-dev
Subject:    Re: cvs commit: httpd-2.0/modules/proxy proxy_http.c
From:       Cliff Woolley <cliffwoolley () yahoo ! com>
Date:       2001-09-29 21:19:38
[Download RAW message or body]

On Sat, 29 Sep 2001, Graham Leggett wrote:

> > Should the pool used for an active FTP connection therefore also be
> > immortal?
>
> As I understand it the reference to the immortal bucket was because CRLF
> is a static string, and creating a 3 byte buffer for the string is a
> waste.

Almost, not quite.  The bucket type you use _must_ represent the actual
type of the data you put in it (not what type you want it to become).  If
you put in data that's been allocated from a pool (eg with psprintf or
pstrdup or pstrcat or whatever), then you use a pool bucket.  If you put
in a static string like "\r\n", you must use an immortal bucket.  Putting
it into a bucket type other than what it really is could cause bad things
to happen, like trying to free a const string for example.

So what you said above is correct up until the part about creating a 3
byte buffer, because pool_create does NOT create a buffer to copy its
argument into... it uses the original entity.  Remember, this a zero-copy
mentality.  =-)

(There is one exception to all this, which is heap_create with the copy
flag set, which actually copies the input string onto the heap and makes a
bucket around THAT.)

--Cliff

--------------------------------------------------------------
   Cliff Woolley
   cliffwoolley@yahoo.com
   Charlottesville, VA

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic