You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@axis.apache.org by John Hawkins <HA...@uk.ibm.com> on 2004/08/04 21:55:49 UTC

Memory improvements?




Hi Folks,

would it be sensible to use the maximum length of string data members in
order to create attributes to the right size?
e.g.

            <element name="covgid__api__rqst__typ__cd">

                <simpleType>
                    <restriction base="string">
                        <maxLength value="10"/>
                    </restriction>
                </simpleType>
            </element>
            <element name="covgid__api__rc">

                <simpleType>
                    <restriction base="string">
                        <maxLength value="2"/>
                    </restriction>
                </simpleType>
            </element>

With the maximum lengths provided, the generation code can generate:

             char covgid__api_rqst__typ__cd [11];
             char covgid__api__rc [3];

These are better than the current:

             char* covgid__api_rqst__typ__cd;
             char* covgid__api__rc;


I guess we might have issues if the maximum length is not there so we would
end up with some that were correctly sized and some that weren't ?

thoughts?


John Hawkins


RE: Memory improvements?

Posted by Susantha Kumara <su...@opensource.lk>.
The generated wrapper should have appropriate functions to check these
restrictions/enumerations etc when serializing and deserializing. 

Susantha.


> -----Original Message-----
> From: Samisa Abeysinghe [mailto:samisa_abeysinghe@yahoo.com]
> Sent: Thursday, August 05, 2004 5:21 PM
> To: Apache AXIS C Developers List
> Subject: Re: Memory improvements?
> 
> 
> --- John Hawkins <HA...@uk.ibm.com> wrote:
> 
> >
> >
> >
> >
> > Hi Folks,
> >
> > would it be sensible to use the maximum length of string data
members in
> > order to create attributes to the right size?
> > e.g.
> >
> >             <element name="covgid__api__rqst__typ__cd">
> >
> >                 <simpleType>
> >                     <restriction base="string">
> >                         <maxLength value="10"/>
> >                     </restriction>
> >                 </simpleType>
> >             </element>
> >             <element name="covgid__api__rc">
> >
> >                 <simpleType>
> >                     <restriction base="string">
> >                         <maxLength value="2"/>
> >                     </restriction>
> >                 </simpleType>
> >             </element>
> >
> > With the maximum lengths provided, the generation code can generate:
> >
> >              char covgid__api_rqst__typ__cd [11];
> >              char covgid__api__rc [3];
> >
> > These are better than the current:
> >
> >              char* covgid__api_rqst__typ__cd;
> >              char* covgid__api__rc;
> >
> 
> I do not see any advantage of using the array over char pointers as
C/C++
> does not check array
> bounds anyway. So in both cases the user would have to keep an evey on
the
> size. The fact that it
> is declased as an array does not give any help when storing a value to
the
> array.
> Hence a better option would be to have an additional data member to
track
> the size (-1 in case of
> unspecified size)
> 
> One complication of using an array for strings with size during
generation
> time would be that in
> case of unspecified size strings, it will still have to use a pointer
> (because an array cannot be
> used). This will not only complicate the Java tool code, but also
would
> complicate the end users
> code where he has to know when to use pinters and when not to.
> 
> For consistancy and simplicity, I propose that we stick to char* with
> additional member to keep
> track of size.
> 
> 
> Thanks,
> Samisa...
> 
> 
> >
> > I guess we might have issues if the maximum length is not there so
we
> would
> > end up with some that were correctly sized and some that weren't ?
> >
> > thoughts?
> >
> >
> > John Hawkins
> >
> >
> 
> 
> 
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Mail - 50x more storage than other providers!
> http://promotions.yahoo.com/new_mail


Re: Memory improvements?

Posted by Samisa Abeysinghe <sa...@yahoo.com>.
--- John Hawkins <HA...@uk.ibm.com> wrote:

> 
> 
> 
> 
> Hi Folks,
> 
> would it be sensible to use the maximum length of string data members in
> order to create attributes to the right size?
> e.g.
> 
>             <element name="covgid__api__rqst__typ__cd">
> 
>                 <simpleType>
>                     <restriction base="string">
>                         <maxLength value="10"/>
>                     </restriction>
>                 </simpleType>
>             </element>
>             <element name="covgid__api__rc">
> 
>                 <simpleType>
>                     <restriction base="string">
>                         <maxLength value="2"/>
>                     </restriction>
>                 </simpleType>
>             </element>
> 
> With the maximum lengths provided, the generation code can generate:
> 
>              char covgid__api_rqst__typ__cd [11];
>              char covgid__api__rc [3];
> 
> These are better than the current:
> 
>              char* covgid__api_rqst__typ__cd;
>              char* covgid__api__rc;
> 

I do not see any advantage of using the array over char pointers as C/C++ does not check array
bounds anyway. So in both cases the user would have to keep an evey on the size. The fact that it
is declased as an array does not give any help when storing a value to the array.
Hence a better option would be to have an additional data member to track the size (-1 in case of
unspecified size)

One complication of using an array for strings with size during generation time would be that in
case of unspecified size strings, it will still have to use a pointer (because an array cannot be
used). This will not only complicate the Java tool code, but also would complicate the end users
code where he has to know when to use pinters and when not to. 

For consistancy and simplicity, I propose that we stick to char* with additional member to keep
track of size.


Thanks,
Samisa...


> 
> I guess we might have issues if the maximum length is not there so we would
> end up with some that were correctly sized and some that weren't ?
> 
> thoughts?
> 
> 
> John Hawkins
> 
> 



		
__________________________________
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail