On Wed, 14 Nov 2001, Brian Pane wrote:

> apr_mmap_dup() with an optimization for the ancestor-pool case sounds
> good to me.  Actually, with a slight modification, I think this can
> handle the non-ancestor-pool case too:
>   * Create a reference count, in storage outside of any pool.  (I have
>     no major reservations about doing a malloc for this, since it's quick
>     compared to the mmap itself.  If it ever became a bottleneck, we could
>     add a custom free list.)
>   * Set the reference count to 1 when it's created, and increment in
>     apr_mmap_dup().
>   * In mmap_cleanup(), decrement the reference count.  If it's now zero,
>     munmap, and free the struct that holds the reference count.  If the
>     reference count is nonzero, do nothing.

+1!  I like this.  The hackishness of doing all this in mmap_setaside was
making me queasy.  :-)

--Cliff


--------------------------------------------------------------
   Cliff Woolley
   [EMAIL PROTECTED]
   Charlottesville, VA


Reply via email to