Return-Path: Delivered-To: apmail-ws-axis-c-user-archive@www.apache.org Received: (qmail 35107 invoked from network); 21 Nov 2007 03:55:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 21 Nov 2007 03:55:24 -0000 Received: (qmail 24116 invoked by uid 500); 21 Nov 2007 03:55:09 -0000 Delivered-To: apmail-ws-axis-c-user-archive@ws.apache.org Received: (qmail 24104 invoked by uid 500); 21 Nov 2007 03:55:09 -0000 Mailing-List: contact axis-c-user-help@ws.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: "Apache AXIS C User List" Reply-To: "Apache AXIS C User List" Delivered-To: mailing list axis-c-user@ws.apache.org Received: (qmail 24093 invoked by uid 99); 21 Nov 2007 03:55:09 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Nov 2007 19:55:09 -0800 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [209.68.5.9] (HELO relay00.pair.com) (209.68.5.9) by apache.org (qpsmtpd/0.29) with SMTP; Wed, 21 Nov 2007 03:55:13 +0000 Received: (qmail 20017 invoked from network); 21 Nov 2007 03:54:49 -0000 Received: from unknown (HELO ?10.100.1.184?) (unknown) by unknown with SMTP; 21 Nov 2007 03:54:49 -0000 X-pair-Authenticated: 124.43.40.77 Subject: Re: Freeing in axutil_array_list From: Manjula Peiris To: Apache AXIS C User List In-Reply-To: <535BC169F3AFFD47926A743A46F882C8AE2B87@CORPUSMX60C.corp.emc.com> References: <535BC169F3AFFD47926A743A46F882C8AE2B87@CORPUSMX60C.corp.emc.com> Content-Type: text/plain Date: Wed, 21 Nov 2007 09:24:45 +0530 Message-Id: <1195617285.4177.15.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.10.2 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Hi Edward, Please see my comments inline. On Tue, 2007-11-20 at 16:33 -0500, Liu_Edward@emc.com wrote: > I did some investigation in the source code for axutil_array_list_free > and I noticed that the individual array elements in array_list are not > being freed up, just the entire data object. From my diff, here is the > change I made (lines starting with the plus): > > Index: util/src/array_list.c > =================================================================== > --- util/src/array_list.c (revision xxxx) > +++ util/src/array_list.c (working copy) > @@ -258,7 +258,14 @@ > > if (array_list->data) > { > + int i; > + for (i = 0; i < array_list->size; i++) > + { > + AXIS2_FREE(env->allocator, array_list->data[i]); > + array_list->data[i] = NULL; > + } > AXIS2_FREE(env->allocator, array_list->data); > + array_list->data = NULL; > } > AXIS2_FREE(env->allocator, array_list); > return; > > With these new lines, I noticed that there is a slight improvement, with > less memory leakage. The increase in memory recovery is very > beneficial, whether small or large, for me. Is there a reason why the > individual elements were not being freed up in the first place? Yes in the real situation we don't know what sort of data type is stored in the arraylist. so we can't use AXIS2_FREE to free those individual elements. Those should be freed using there own free function. So it is arraylist user's responsibility to free those individual elements. -Manjula. > > Thanks, > Edward > > --------------------------------------------------------------------- > To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org > For additional commands, e-mail: axis-c-user-help@ws.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org For additional commands, e-mail: axis-c-user-help@ws.apache.org