Return-Path: Delivered-To: apmail-ws-axis-c-dev-archive@www.apache.org Received: (qmail 58594 invoked from network); 3 Jun 2004 06:04:30 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 3 Jun 2004 06:04:30 -0000 Received: (qmail 34901 invoked by uid 500); 3 Jun 2004 06:04:50 -0000 Delivered-To: apmail-ws-axis-c-dev-archive@ws.apache.org Received: (qmail 34889 invoked by uid 500); 3 Jun 2004 06:04:50 -0000 Mailing-List: contact axis-c-dev-help@ws.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: List-Id: "Apache AXIS C Developers List" Reply-To: "Apache AXIS C Developers List" Delivered-To: mailing list axis-c-dev@ws.apache.org Received: (qmail 34875 invoked by uid 99); 3 Jun 2004 06:04:50 -0000 Received: from [209.68.3.41] (HELO wbm1.pair.net) (209.68.3.41) by apache.org (qpsmtpd/0.27.1) with SMTP; Wed, 02 Jun 2004 23:04:50 -0700 Received: (qmail 30189 invoked by uid 65534); 3 Jun 2004 06:04:08 -0000 Received: from 220.247.252.202 ([220.247.252.202]) (SquirrelMail authenticated user susantha@opensource.lk); by webmail1.pair.com with HTTP; Thu, 3 Jun 2004 02:04:08 -0400 (EDT) Message-ID: <32909.220.247.252.202.1086242648.squirrel@220.247.252.202> In-Reply-To: <40BD204D.5030802@cs.indiana.edu> References: <40BD204D.5030802@cs.indiana.edu> Date: Thu, 3 Jun 2004 02:04:08 -0400 (EDT) Subject: Re: returning array of string from service From: susantha@opensource.lk To: "Apache AXIS C Developers List" User-Agent: SquirrelMail/1.4.3-RC1 X-Mailer: SquirrelMail/1.4.3-RC1 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Hi, > i have a simple service implemented in Axis-C++ that take as input array > length and returns new arrray of strings. > > is it the right way to do it so there is no memory leaks (i looked on > InteropBaseClient.cpp ti see how string arrays are created). > > xsd__string_Array Benchmark1PortType::sendStrings(int length) > { > xsd__string_Array arr; > arr.m_Size = length; > arr.m_Array = new char*[length]; > for (int i=0; i < length; i++) { > arr.m_Array[i] = strdup("hello str::Alek"); > } > return arr; > } Yes. This returned array will be de-allocated after serialization. So no memory leaks. > > i would like to see how server side AXIS-C++ works in longer run > (especially memory handling) so i would like to get this right ... > > thanks, > > alek > > BTW: maybe it would be good idea to have consistent naming for example > xsd__base64Binary::__size and xsd__string_Array::m_Size - shouldnt both > use m_Size? that makes this method asymmetrical to all other methods > handling arrays: xsd__xxxx are Axis defined types and xsd__xxxx_Array are Axis defined array structures. > > xsd__base64Binary Benchmark1PortType::sendBase64(int length) > { > xsd__base64Binary arr; > arr.__size = length; > arr.__ptr = new xsd__unsignedByte[length]; > for (int i=0; i < length; i++) { > arr.__ptr[i] = (xsd__unsignedByte)i; > } > return arr; > } > > -- > The best way to predict the future is to invent it - Alan Kay > > >