dougm 2002/06/20 20:02:54
Modified:src/modules/perl modperl_interp.c modperl_interp.h
modperl_tipool.c modperl_tipool.h modperl_types.h
Log:
stop using an apr_pool_t to allocate items for the interpreter pool:
-even though we lock, the pool is read by modules other than mod_perl
-when a PerlInterpreter is released to to PerlInterp{MaxRequests,MinSpare}
the pool item allocation leaks because the server pool is not
cleared until restart
Revision ChangesPath
1.48 +9 -7 modperl-2.0/src/modules/perl/modperl_interp.c
Index: modperl_interp.c
===
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_interp.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- modperl_interp.c 21 Jun 2002 00:44:24 - 1.47
+++ modperl_interp.c 21 Jun 2002 03:02:54 - 1.48
-35,14 +35,15
modperl_xs_dl_handles_clear(aTHX);
}
-modperl_interp_t *modperl_interp_new(apr_pool_t *p,
- modperl_interp_pool_t *mip,
+modperl_interp_t *modperl_interp_new(modperl_interp_pool_t *mip,
PerlInterpreter *perl)
{
UV clone_flags = 0;
modperl_interp_t *interp =
-(modperl_interp_t *)apr_pcalloc(p, sizeof(*interp));
-
+(modperl_interp_t *)malloc(sizeof(*interp));
+
+memset(interp, '\0', sizeof(*interp));
+
interp-mip = mip;
interp-refcnt = 0; /* for use by APR::Pool-cleanup_register */
-97,6 +98,8
modperl_perl_destruct(interp-perl);
modperl_xs_dl_handles_close(handles);
+
+free(interp);
}
apr_status_t modperl_interp_cleanup(void *data)
-162,7 +165,7
{
modperl_interp_pool_t *mip = (modperl_interp_pool_t *)data;
MP_TRACE_i(MP_FUNC, adding new interpreter to the pool\n);
-return (void *)modperl_interp_new(mip-ap_pool, mip, mip-parent-perl);
+return (void *)modperl_interp_new(mip, mip-parent-perl);
}
static void interp_pool_shrink(modperl_tipool_t *tipool, void *data,
-206,9 +209,8
interp_pool_func, mip);
mip-tipool = tipool;
-mip-ap_pool = p;
mip-server = s;
-mip-parent = modperl_interp_new(p, mip, NULL);
+mip-parent = modperl_interp_new(mip, NULL);
aTHX = mip-parent-perl = perl;
/* this happens post-config in mod_perl.c:modperl_init_clones() */
1.16 +1 -2 modperl-2.0/src/modules/perl/modperl_interp.h
Index: modperl_interp.h
===
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_interp.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- modperl_interp.h 13 Jun 2002 02:59:05 - 1.15
+++ modperl_interp.h 21 Jun 2002 03:02:54 - 1.16
-23,8 +23,7
void modperl_interp_clone_init(modperl_interp_t *interp);
-modperl_interp_t *modperl_interp_new(apr_pool_t *p,
- modperl_interp_pool_t *mip,
+modperl_interp_t *modperl_interp_new(modperl_interp_pool_t *mip,
PerlInterpreter *perl);
void modperl_interp_destroy(modperl_interp_t *interp);
1.8 +6 -4 modperl-2.0/src/modules/perl/modperl_tipool.c
Index: modperl_tipool.c
===
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_tipool.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- modperl_tipool.c 8 Mar 2002 02:48:01 - 1.7
+++ modperl_tipool.c 21 Jun 2002 03:02:54 - 1.8
-15,10 +15,11
* this is another proof-of-concept, plenty of room for improvement here
*/
-modperl_list_t *modperl_list_new(apr_pool_t *p)
+modperl_list_t *modperl_list_new()
{
modperl_list_t *listp =
-(modperl_list_t *)apr_pcalloc(p, sizeof(*listp));
+(modperl_list_t *)malloc(sizeof(*listp));
+memset(listp, '\0', sizeof(*listp));
return listp;
}
-151,7 +152,6
modperl_tipool_t *tipool =
(modperl_tipool_t *)apr_pcalloc(p, sizeof(*tipool));
-tipool-ap_pool = p;
tipool-cfg = cfg;
tipool-func = func;
tipool-data = data;
-201,7 +201,7
void modperl_tipool_add(modperl_tipool_t *tipool, void *data)
{
-modperl_list_t *listp = modperl_list_new(tipool-ap_pool);
+modperl_list_t *listp = modperl_list_new();
listp-data = data;
-339,6 +339,8
(*tipool-func-tipool_destroy)(tipool, tipool-data,
listp-data);
}
+
+free(listp); /* gone for good */
if (max_requests