apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <...@covalent.net>
Subject Re: apr_dso_handle_close ?
Date Tue, 17 Apr 2001 14:32:02 GMT

> Let's just have:
>
>   apr_dso_make(apr_dso_handle_t **h, void *plat_hand, apr_pool_t *p);
>
> I know that Doug wants to do something like:
>
>     apr_dso_make(&h, p);
>     apr_dso_fill(h, handle1);
>     apr_dso_unload(h);
>     apr_dso_fill(h, handle2);
>     apr_dso_unload(h);
>     apr_dso_fill(h, handle3);
>     apr_dso_unload(h);
>
> But I'd say:
>
>     sub = apr_create_pool(p);
>     apr_dso_make(&h, handle1, sub);
>     apr_dso_unload(h);
>     apr_dso_make(&h, handle2, sub);
>     apr_dso_unload(h);
>     apr_dso_make(&h, handle3, sub);
>     apr_dso_unload(h);
>     apr_pool_destroy(sub);
>
> That keeps our API simpler. If somebody doesn't want to care about memory so
> much, then the subpool isn't even needed. As I mentioned before, if you're
> tossing DSO's, I bet there is a pool that is getting tossed, too (so the
> apr_dso_make memory can go in there for a short period).

a) I disagree that just because something is being unloaded, a pool is
going away.

> Heck, I just realized. This is even cleaner:
>
>     sub = apr_create_pool(p);
>     apr_dso_make(&h, handle1, sub);
>     apr_dso_make(&h, handle2, sub);
>     apr_dso_make(&h, handle3, sub);
>     apr_pool_destroy(sub);
>
> Since DSO's go away with the pool they're registered in, the above will toss
> all the DSOs at pool destruction. Of course, you don't get error feedback
> from each unload(), but it all depends on whether you even *want* it.
>
> Anyhow... let's have just a single apr_dso_make(). I don't need a need for
> two functions.

b) With the model above, we are allocating everytime we want to fill out
an apr_dso_handle_t.  That is a performance waste.  We are allocating just
to immediately lose that memory, and re-allocate it.  In fact, not only is
this a performance waste, it is a resource waste.  You allocated 1
sub-pool, and 3 apr_dso_handle_t's.  My model uses one apr_dso_handle_t.
If the pool doesn't die immediately, then we have a bunch of wasted
memory.

Ryan

_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------


Mime
View raw message