httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jaysingh Samuel <jayasingh.sam...@hotmail.com>
Subject RE: Memory leaks on adding module directives on virtual host.
Date Mon, 13 Jul 2009 04:32:40 GMT


Thanks all for your reply.
I store a structure in the serverConfig and most of the member get sets from the http config
directives.. Two member of this structure are pointed to a hash Table which is not a apr..
This hash Table i create on post_config and added a cleanup function in the postConfig. 
And for supporting the virtual host, i have server config Merger where i have another copy
of the serverConfig and i set the members with the directives found in the http config and
if not found will copy the base server Config directives. 
The hash table i don't copy instead i just copy the pointer of the base Server config to the
virtual config.  
I guess the memory leak is because of this. 
Do we have solution where we can use the base Server hast table in the virtual host without
any Memory Leak?
Thanks in advance, Jaysingh

> Subject: RE: Memory leaks on adding module directives on virtual host.
> From: jzobel@heute-morgen.de
> To: jayasingh.samuel@hotmail.com
> CC: modules-dev@httpd.apache.org
> Date: Thu, 9 Jul 2009 21:28:08 +0200
> 
> Am Donnerstag, den 09.07.2009, 09:11 +0530 schrieb Jaysingh Samuel:
> > In the command table we get the serverConfig pointer and store the
> > value like the following. 
> > serverConf =
> >  ap_get_module_config(parms->server->module_config, &xyz_module); 
> > 
> > serverConf->abc = apr_pstrdup(parms->pool, arg);
> 
> This looks OK and you should not need any cleanup function to free the
> memory allocated by apr_strdup. You don't allocate any memory with
> malloc or the like?
> 
> You could however use apr_pool_cleanup_register on the parms->pool to
> register a cleanup function that writes a log entry every time the pool
> is cleared or destroyed.
> 
> Sincerely,
> Joachim
> 
> 

_________________________________________________________________
Stay updated! Add Facebook, LinkedIn, MySpace & Hi5  friends to your Windows Live network
instantly. Add Now!
http://profile.live.com/webactivities/?mkt=en-in
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message