This isn't the right thing to do. It leaves the gmetric memory allocation coming from two different pools with no way to clean it up completely. It actually introduces a memory leak. See my comments in the bug (http://bugzilla.ganglia.info/cgi-bin/bugzilla/show_bug.cgi?id=190). A gmetric represents a single transaction. It must be created, set, used and destroyed. This needs to be reverted to r1386.
Brad >>> On 6/13/2008 at 5:20 PM, in message <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> wrote: > Revision: 1411 > http://ganglia.svn.sourceforge.net/ganglia/?rev=1411&view=rev > Author: bernardli > Date: 2008-06-13 16:20:32 -0700 (Fri, 13 Jun 2008) > > Log Message: > ----------- > Fix potential memory leak and segmentation fault caused by misuse of APR > memory pool (bugzilla #190). > > Submitted-by: Masaaki HIROSE <[EMAIL PROTECTED]> > Reviewed-by: Bernard Li <[EMAIL PROTECTED]> > > Modified Paths: > -------------- > trunk/monitor-core/lib/libgmond.c > > Modified: trunk/monitor-core/lib/libgmond.c > =================================================================== > --- trunk/monitor-core/lib/libgmond.c 2008-06-13 15:49:40 UTC (rev 1410) > +++ trunk/monitor-core/lib/libgmond.c 2008-06-13 23:20:32 UTC (rev 1411) > @@ -368,21 +368,19 @@ > { > return NULL; > } > - gmetric = apr_pcalloc( pool, sizeof(struct Ganglia_metric)); > + gmetric = apr_pcalloc( parent_pool, sizeof(struct Ganglia_metric)); > if(!gmetric) > { > - Ganglia_pool_destroy((Ganglia_pool)pool); > return NULL; > } > > gmetric->pool = (Ganglia_pool)pool; > - gmetric->msg = apr_pcalloc( pool, sizeof(struct > Ganglia_metadata_message)); > + gmetric->msg = apr_pcalloc( parent_pool, sizeof(struct > Ganglia_metadata_message)); > if(!gmetric->msg) > { > - Ganglia_pool_destroy((Ganglia_pool)pool); > return NULL; > } > - gmetric->extra = (void*)apr_table_make(pool, 2); > + gmetric->extra = (void*)apr_table_make(parent_pool, 2); > > return gmetric; > } > > > This was sent by the SourceForge.net collaborative development platform, the > world's largest Open Source development site. > > ------------------------------------------------------------------------- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > _______________________________________________ > Ganglia-svn mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/ganglia-svn ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Ganglia-developers mailing list Ganglia-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ganglia-developers