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 Steve Leland <st...@pouchapond.com> on 2010/06/27 19:02:12 UTC

memory leak in generated code

Hi,

I am running on Windows Server 2008 R2, and using a build I made yesterday 
(svn 957643) I generated code from our wsdl and ran it - it has a leak that 
was also present in the 1.6.0 release.

Given this in the wsdl file:

      <s:complexType name="CalendarEvent">
        <s:sequence>
          <s:element minOccurs="1" maxOccurs="1" name="StartTime" 
type="s:dateTime" />
          <s:element minOccurs="1" maxOccurs="1" name="EndTime" 
type="s:dateTime" />
          <s:element minOccurs="1" maxOccurs="1" name="BusyType" 
type="tns:LegacyFreeBusyType" />
          <s:element minOccurs="0" maxOccurs="1" name="CalendarEventDetails" 
type="tns:CalendarEventDetails" />
        </s:sequence>
      </s:complexType>

the following code is generated:

                   if (!_CalendarEvent->is_valid_StartTime)
                   {


                            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Nil 
value found in non-nillable property StartTime");
                            return NULL;

                   }
                   else
                   {
                     start_input_str = 
(axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
                                 (4 + axutil_strlen(p_prefix) +
                                  axutil_strlen("StartTime")));

                                 /* axutil_strlen("<:>") + 1 = 4 */
                     end_input_str = 
(axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
                                 (5 + axutil_strlen(p_prefix) + 
axutil_strlen("StartTime")));
                                  /* axutil_strlen("</:>") + 1 = 5 */






                     /*
                      * parsing StartTime element
                      */



                            sprintf(start_input_str, "<%s%sStartTime>",
                                 p_prefix?p_prefix:"",
                                 (p_prefix && axutil_strcmp(p_prefix, 
""))?":":"");

                        start_input_str_len = 
axutil_strlen(start_input_str);
                        sprintf(end_input_str, "</%s%sStartTime>",
                                 p_prefix?p_prefix:"",
                                 (p_prefix && axutil_strcmp(p_prefix, 
""))?":":"");
                        end_input_str_len = axutil_strlen(end_input_str);

                          text_value_1 = 
axutil_date_time_serialize_date_time(_CalendarEvent->property_StartTime, 
env);

                           axutil_stream_write(stream, env, start_input_str, 
start_input_str_len);

                           axutil_stream_write(stream, env, text_value_1, 
axutil_strlen(text_value_1));

                           axutil_stream_write(stream, env, end_input_str, 
end_input_str_len);

                 -> fix goes here <-
                     AXIS2_FREE(env->allocator,start_input_str);
                     AXIS2_FREE(env->allocator,end_input_str);
                 }

The leak is "text_value_1" not being freed.  To fix the leak, add
AXIS2_FREE(env->allocator,text_value_1);
where indicated.

Regards,
Steve





---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: c-dev-help@axis.apache.org


Re: memory leak in generated code

Posted by Samisa Abeysinghe <sa...@gmail.com>.
On Wed, Jul 7, 2010 at 9:51 PM, Steve Leland <st...@pouchapond.com> wrote:

>  I'd be willing to give it a try, but right now I know nothing about
> how code generation works - turn around time for a fix may not be great.
> Any doc or info that would serve as a starting point would really help...
> nothing should be considered too basic, I don't even know where the code
> generation template can be found.
>

The code generation template is in Axis2 Java as we use the same Java tool.

This is one line fix, so I can fix it for you.

Samisa ...

http://samisa-abeysinghe.blogspot.com/

Re: memory leak in generated code

Posted by Samisa Abeysinghe <sa...@gmail.com>.
On Wed, Jul 7, 2010 at 9:51 PM, Steve Leland <st...@pouchapond.com> wrote:

>  I'd be willing to give it a try, but right now I know nothing about
> how code generation works - turn around time for a fix may not be great.
> Any doc or info that would serve as a starting point would really help...
> nothing should be considered too basic, I don't even know where the code
> generation template can be found.
>

The code generation template is in Axis2 Java as we use the same Java tool.

This is one line fix, so I can fix it for you.

Samisa ...

http://samisa-abeysinghe.blogspot.com/

Re: memory leak in generated code

Posted by Steve Leland <st...@pouchapond.com>.
I'd be willing to give it a try, but right now I know nothing about how code generation works - turn around time for a fix may not be great.  Any doc or info that would serve as a starting point would really help... nothing should be considered too basic, I don't even know where the code generation template can be found.

Thanks,
Steve

----- Original Message ----- 
  From: Samisa Abeysinghe 
  To: Apache AXIS C Developers List 
  Sent: Tuesday, July 06, 2010 7:23 PM
  Subject: Re: memory leak in generated code


  This needs to be fixed in the code generation template so that the fix works right for all generated code.


  Is it possible for you to provide a patch for that?



  Samisa...


  On Sun, Jun 27, 2010 at 10:32 PM, Steve Leland <st...@pouchapond.com> wrote:

    Hi,

    I am running on Windows Server 2008 R2, and using a build I made yesterday (svn 957643) I generated code from our wsdl and ran it - it has a leak that was also present in the 1.6.0 release.

    Given this in the wsdl file:

        <s:complexType name="CalendarEvent">
          <s:sequence>
            <s:element minOccurs="1" maxOccurs="1" name="StartTime" type="s:dateTime" />
            <s:element minOccurs="1" maxOccurs="1" name="EndTime" type="s:dateTime" />
            <s:element minOccurs="1" maxOccurs="1" name="BusyType" type="tns:LegacyFreeBusyType" />
            <s:element minOccurs="0" maxOccurs="1" name="CalendarEventDetails" type="tns:CalendarEventDetails" />
          </s:sequence>
        </s:complexType>

    the following code is generated:

                     if (!_CalendarEvent->is_valid_StartTime)
                     {


                              AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Nil value found in non-nillable property StartTime");
                              return NULL;

                     }
                     else
                     {
                       start_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
                                   (4 + axutil_strlen(p_prefix) +
                                    axutil_strlen("StartTime")));

                                   /* axutil_strlen("<:>") + 1 = 4 */
                       end_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
                                   (5 + axutil_strlen(p_prefix) + axutil_strlen("StartTime")));
                                    /* axutil_strlen("</:>") + 1 = 5 */






                       /*
                        * parsing StartTime element
                        */



                              sprintf(start_input_str, "<%s%sStartTime>",
                                   p_prefix?p_prefix:"",
                                   (p_prefix && axutil_strcmp(p_prefix, ""))?":":"");

                          start_input_str_len = axutil_strlen(start_input_str);
                          sprintf(end_input_str, "</%s%sStartTime>",
                                   p_prefix?p_prefix:"",
                                   (p_prefix && axutil_strcmp(p_prefix, ""))?":":"");
                          end_input_str_len = axutil_strlen(end_input_str);

                            text_value_1 = axutil_date_time_serialize_date_time(_CalendarEvent->property_StartTime, env);

                             axutil_stream_write(stream, env, start_input_str, start_input_str_len);

                             axutil_stream_write(stream, env, text_value_1, axutil_strlen(text_value_1));

                             axutil_stream_write(stream, env, end_input_str, end_input_str_len);

                   -> fix goes here <-
                       AXIS2_FREE(env->allocator,start_input_str);
                       AXIS2_FREE(env->allocator,end_input_str);
                   }

    The leak is "text_value_1" not being freed.  To fix the leak, add
    AXIS2_FREE(env->allocator,text_value_1);
    where indicated.

    Regards,
    Steve





    ---------------------------------------------------------------------
    To unsubscribe, e-mail: c-dev-unsubscribe@axis.apache.org
    For additional commands, e-mail: c-dev-help@axis.apache.org


  Samisa Abeysinghe
  VP Engineering
  WSO2 Inc. 
  http://wso2.com
  http://wso2.org



Re: memory leak in generated code

Posted by Steve Leland <st...@pouchapond.com>.
I'd be willing to give it a try, but right now I know nothing about how code generation works - turn around time for a fix may not be great.  Any doc or info that would serve as a starting point would really help... nothing should be considered too basic, I don't even know where the code generation template can be found.

Thanks,
Steve

----- Original Message ----- 
  From: Samisa Abeysinghe 
  To: Apache AXIS C Developers List 
  Sent: Tuesday, July 06, 2010 7:23 PM
  Subject: Re: memory leak in generated code


  This needs to be fixed in the code generation template so that the fix works right for all generated code.


  Is it possible for you to provide a patch for that?



  Samisa...


  On Sun, Jun 27, 2010 at 10:32 PM, Steve Leland <st...@pouchapond.com> wrote:

    Hi,

    I am running on Windows Server 2008 R2, and using a build I made yesterday (svn 957643) I generated code from our wsdl and ran it - it has a leak that was also present in the 1.6.0 release.

    Given this in the wsdl file:

        <s:complexType name="CalendarEvent">
          <s:sequence>
            <s:element minOccurs="1" maxOccurs="1" name="StartTime" type="s:dateTime" />
            <s:element minOccurs="1" maxOccurs="1" name="EndTime" type="s:dateTime" />
            <s:element minOccurs="1" maxOccurs="1" name="BusyType" type="tns:LegacyFreeBusyType" />
            <s:element minOccurs="0" maxOccurs="1" name="CalendarEventDetails" type="tns:CalendarEventDetails" />
          </s:sequence>
        </s:complexType>

    the following code is generated:

                     if (!_CalendarEvent->is_valid_StartTime)
                     {


                              AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Nil value found in non-nillable property StartTime");
                              return NULL;

                     }
                     else
                     {
                       start_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
                                   (4 + axutil_strlen(p_prefix) +
                                    axutil_strlen("StartTime")));

                                   /* axutil_strlen("<:>") + 1 = 4 */
                       end_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
                                   (5 + axutil_strlen(p_prefix) + axutil_strlen("StartTime")));
                                    /* axutil_strlen("</:>") + 1 = 5 */






                       /*
                        * parsing StartTime element
                        */



                              sprintf(start_input_str, "<%s%sStartTime>",
                                   p_prefix?p_prefix:"",
                                   (p_prefix && axutil_strcmp(p_prefix, ""))?":":"");

                          start_input_str_len = axutil_strlen(start_input_str);
                          sprintf(end_input_str, "</%s%sStartTime>",
                                   p_prefix?p_prefix:"",
                                   (p_prefix && axutil_strcmp(p_prefix, ""))?":":"");
                          end_input_str_len = axutil_strlen(end_input_str);

                            text_value_1 = axutil_date_time_serialize_date_time(_CalendarEvent->property_StartTime, env);

                             axutil_stream_write(stream, env, start_input_str, start_input_str_len);

                             axutil_stream_write(stream, env, text_value_1, axutil_strlen(text_value_1));

                             axutil_stream_write(stream, env, end_input_str, end_input_str_len);

                   -> fix goes here <-
                       AXIS2_FREE(env->allocator,start_input_str);
                       AXIS2_FREE(env->allocator,end_input_str);
                   }

    The leak is "text_value_1" not being freed.  To fix the leak, add
    AXIS2_FREE(env->allocator,text_value_1);
    where indicated.

    Regards,
    Steve





    ---------------------------------------------------------------------
    To unsubscribe, e-mail: c-dev-unsubscribe@axis.apache.org
    For additional commands, e-mail: c-dev-help@axis.apache.org


  Samisa Abeysinghe
  VP Engineering
  WSO2 Inc. 
  http://wso2.com
  http://wso2.org



Re: memory leak in generated code

Posted by Samisa Abeysinghe <sa...@wso2.com>.
This needs to be fixed in the code generation template so that the fix works
right for all generated code.

Is it possible for you to provide a patch for that?

Samisa...

On Sun, Jun 27, 2010 at 10:32 PM, Steve Leland <st...@pouchapond.com> wrote:

> Hi,
>
> I am running on Windows Server 2008 R2, and using a build I made yesterday
> (svn 957643) I generated code from our wsdl and ran it - it has a leak that
> was also present in the 1.6.0 release.
>
> Given this in the wsdl file:
>
>     <s:complexType name="CalendarEvent">
>       <s:sequence>
>         <s:element minOccurs="1" maxOccurs="1" name="StartTime"
> type="s:dateTime" />
>         <s:element minOccurs="1" maxOccurs="1" name="EndTime"
> type="s:dateTime" />
>         <s:element minOccurs="1" maxOccurs="1" name="BusyType"
> type="tns:LegacyFreeBusyType" />
>         <s:element minOccurs="0" maxOccurs="1" name="CalendarEventDetails"
> type="tns:CalendarEventDetails" />
>       </s:sequence>
>     </s:complexType>
>
> the following code is generated:
>
>                  if (!_CalendarEvent->is_valid_StartTime)
>                  {
>
>
>                           AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Nil
> value found in non-nillable property StartTime");
>                           return NULL;
>
>                  }
>                  else
>                  {
>                    start_input_str =
> (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
>                                (4 + axutil_strlen(p_prefix) +
>                                 axutil_strlen("StartTime")));
>
>                                /* axutil_strlen("<:>") + 1 = 4 */
>                    end_input_str =
> (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
>                                (5 + axutil_strlen(p_prefix) +
> axutil_strlen("StartTime")));
>                                 /* axutil_strlen("</:>") + 1 = 5 */
>
>
>
>
>
>
>                    /*
>                     * parsing StartTime element
>                     */
>
>
>
>                           sprintf(start_input_str, "<%s%sStartTime>",
>                                p_prefix?p_prefix:"",
>                                (p_prefix && axutil_strcmp(p_prefix,
> ""))?":":"");
>
>                       start_input_str_len = axutil_strlen(start_input_str);
>                       sprintf(end_input_str, "</%s%sStartTime>",
>                                p_prefix?p_prefix:"",
>                                (p_prefix && axutil_strcmp(p_prefix,
> ""))?":":"");
>                       end_input_str_len = axutil_strlen(end_input_str);
>
>                         text_value_1 =
> axutil_date_time_serialize_date_time(_CalendarEvent->property_StartTime,
> env);
>
>                          axutil_stream_write(stream, env, start_input_str,
> start_input_str_len);
>
>                          axutil_stream_write(stream, env, text_value_1,
> axutil_strlen(text_value_1));
>
>                          axutil_stream_write(stream, env, end_input_str,
> end_input_str_len);
>
>                -> fix goes here <-
>                    AXIS2_FREE(env->allocator,start_input_str);
>                    AXIS2_FREE(env->allocator,end_input_str);
>                }
>
> The leak is "text_value_1" not being freed.  To fix the leak, add
> AXIS2_FREE(env->allocator,text_value_1);
> where indicated.
>
> Regards,
> Steve
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: c-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: c-dev-help@axis.apache.org
>
> Samisa Abeysinghe
VP Engineering
WSO2 Inc.
http://wso2.com
http://wso2.org

Re: memory leak in generated code

Posted by Samisa Abeysinghe <sa...@wso2.com>.
This needs to be fixed in the code generation template so that the fix works
right for all generated code.

Is it possible for you to provide a patch for that?

Samisa...

On Sun, Jun 27, 2010 at 10:32 PM, Steve Leland <st...@pouchapond.com> wrote:

> Hi,
>
> I am running on Windows Server 2008 R2, and using a build I made yesterday
> (svn 957643) I generated code from our wsdl and ran it - it has a leak that
> was also present in the 1.6.0 release.
>
> Given this in the wsdl file:
>
>     <s:complexType name="CalendarEvent">
>       <s:sequence>
>         <s:element minOccurs="1" maxOccurs="1" name="StartTime"
> type="s:dateTime" />
>         <s:element minOccurs="1" maxOccurs="1" name="EndTime"
> type="s:dateTime" />
>         <s:element minOccurs="1" maxOccurs="1" name="BusyType"
> type="tns:LegacyFreeBusyType" />
>         <s:element minOccurs="0" maxOccurs="1" name="CalendarEventDetails"
> type="tns:CalendarEventDetails" />
>       </s:sequence>
>     </s:complexType>
>
> the following code is generated:
>
>                  if (!_CalendarEvent->is_valid_StartTime)
>                  {
>
>
>                           AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Nil
> value found in non-nillable property StartTime");
>                           return NULL;
>
>                  }
>                  else
>                  {
>                    start_input_str =
> (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
>                                (4 + axutil_strlen(p_prefix) +
>                                 axutil_strlen("StartTime")));
>
>                                /* axutil_strlen("<:>") + 1 = 4 */
>                    end_input_str =
> (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
>                                (5 + axutil_strlen(p_prefix) +
> axutil_strlen("StartTime")));
>                                 /* axutil_strlen("</:>") + 1 = 5 */
>
>
>
>
>
>
>                    /*
>                     * parsing StartTime element
>                     */
>
>
>
>                           sprintf(start_input_str, "<%s%sStartTime>",
>                                p_prefix?p_prefix:"",
>                                (p_prefix && axutil_strcmp(p_prefix,
> ""))?":":"");
>
>                       start_input_str_len = axutil_strlen(start_input_str);
>                       sprintf(end_input_str, "</%s%sStartTime>",
>                                p_prefix?p_prefix:"",
>                                (p_prefix && axutil_strcmp(p_prefix,
> ""))?":":"");
>                       end_input_str_len = axutil_strlen(end_input_str);
>
>                         text_value_1 =
> axutil_date_time_serialize_date_time(_CalendarEvent->property_StartTime,
> env);
>
>                          axutil_stream_write(stream, env, start_input_str,
> start_input_str_len);
>
>                          axutil_stream_write(stream, env, text_value_1,
> axutil_strlen(text_value_1));
>
>                          axutil_stream_write(stream, env, end_input_str,
> end_input_str_len);
>
>                -> fix goes here <-
>                    AXIS2_FREE(env->allocator,start_input_str);
>                    AXIS2_FREE(env->allocator,end_input_str);
>                }
>
> The leak is "text_value_1" not being freed.  To fix the leak, add
> AXIS2_FREE(env->allocator,text_value_1);
> where indicated.
>
> Regards,
> Steve
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: c-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: c-dev-help@axis.apache.org
>
> Samisa Abeysinghe
VP Engineering
WSO2 Inc.
http://wso2.com
http://wso2.org