H Dimuthu. Yes, you are right, i am acutally using the nightly build for the java and WSDL2C part. I updated it week or two ago from the version i mentioned here and i did not remember it at the moment.

What i  am actually trying to do:
I would like to create once one adb_EventDTO_t, one adb_EventPerformed_t and reuse it and the memory free at the end of program (i do not have to free the adb_EventDTO_t structure?) + always (at every call) get response (it is created) and free of my own.

What i actually find strange on it: the memory footprint of the program grows with every call the service very significantly (3 calls, initial size 2808KB final size 2836KB). If i would use it in some project to run on machine in scale of days it could be quite hardly usable, that is why i am asking about the memory management in the generated stubs (either i use adb* wrong or the memory management we could fix...).
Martin



Dimuthu Gamage wrote:
Hi martin,

If you are using adb in client side you have to explicitly free the
allocated adb object for (only) the request and response. That is call
adb_EventPerformedResponse_free and adb_EventPerformed_free at the
end.

Seems you are using the nightly build
(http://people.apache.org/dist/axis2/nightly), although you said you
are using axis2-1.3? . If so surely you will be working with the
latest fixes.

Thanks
Dimuthu

On Jan 23, 2008 5:34 PM, martin spurek <[EMAIL PROTECTED]> wrote:
Hello.
I am using axis2c-bin-1.1.0-linux and axis2-1.3
I am few past weeks learning how to use the generated adb stub using
WSDL2C tool. I was doing as an exercise a simple wsdl service in java
and i need to write test client in C. Using the generated stub took mi
some time, however it compiles and work now.
However, if I repeat calling generated
axis2_stub_op_Service_EventPerformed(stub, env, _eventperformed1);
function with every call it increase allocated memory (if i omit it the
memry footprint is constant). It does not depend on whether the service
is running or not, the continuous memory allocation is the same.  I am
not really too familiar with the adb code, so i paste here the function
where i call it and the generated stub. Maybe someone tells me where is
the problem, thanks in advance.
Martin
-------------------------------------------------------------------------------
FIRST function where i use it:
-------------------------------------------------------------------------------
RETURN_TYPE send_single_event(struct event_data *event){
    printf ("AXIS2 sendout - single event... \n");
    //following i keep still the same, declared on the top
    if(EventDTO==NULL) EventDTO = adb_EventDTO_create(env);

    status = adb_EventDTO_set_eventTime( EventDTO, env, event->time );
    status = adb_EventDTO_set_cID( EventDTO, env, event->cID );
    if(status != AXIS2_SUCCESS) return RETURN_FAILURE;

    //following i keep still the same, declared on the top
    if(_eventperformed1==NULL)   _eventperformed1 =
adb_EventPerformed_create(env);

    status = adb_EventPerformed_set_param0( _eventperformed1, env,
EventDTO);
    if(status != AXIS2_SUCCESS) return RETURN_FAILURE;

    _eventperformedresponse2 =
axis2_stub_op_Service_EventPerformed(stub, env, _eventperformed1);
    if (_eventperformedresponse2 == NULL){
        printf("\t!!! the service is not reachable at expected URI
(wrong URI, service not is running or network connection failed)...\n");
    } else {
        printf(" - the Service_EventPerformed returns something...\n");
        //free memory at the end of processing
        adb_EventPerformedResponse_free(_eventperformedresponse2, env);
        _eventperformedresponse2 = NULL;
        // it frees also the serversResponseDTO, but does not NULL the
pointer
    }
    return RETURN_SUCCESS;;
}
-------------------------------------------------------------------------------
SECOND - the generated function i call
    - i did not find yet how long are some pointers hold somewhere
outside, however all the pointers in beginning are not freed locally
-------------------------------------------------------------------------------
    /**
    * auto generated method signature
    * for "EventPerformed|http://axis_interface.vsb.cz"; operation.
    *
    * @param _EventPerformed
    * @return
    */
    adb_EventPerformedResponse_t*
    axis2_stub_op_Service_EventPerformed( axis2_stub_t *stub, const
axutil_env_t *env,
                    adb_EventPerformed_t* _EventPerformed)
{


    axis2_svc_client_t *svc_client = NULL;
    axis2_options_t *options = NULL;
    axiom_node_t *ret_node = NULL;

    const axis2_char_t *soap_action = NULL;
    axutil_qname_t *op_qname =  NULL;
    axiom_node_t *payload = NULL;
    axis2_bool_t is_soap_act_set = AXIS2_TRUE;

    axutil_string_t *soap_act = NULL;
    adb_EventPerformedResponse_t* ret_val = NULL;

        payload = adb_EventPerformed_serialize(_EventPerformed, env,
NULL, NULL, AXIS2_TRUE, NULL, NULL);


    options = axis2_stub_get_options( stub, env);
    if ( NULL == options )
    {
        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM,
AXIS2_FAILURE);
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "options is null in stub");
        return NULL;
    }

    svc_client = axis2_stub_get_svc_client(stub, env );
    soap_action = axis2_options_get_action( options, env );
    if (NULL == soap_action)
    {
        is_soap_act_set = AXIS2_FALSE;
        soap_action = "urn:EventPerformed";
        soap_act = axutil_string_create(env, "urn:EventPerformed");
        axis2_options_set_soap_action(options, env, soap_act);
        axis2_options_set_action( options, env, soap_action );
    }

    axis2_options_set_soap_version(options, env, AXIOM_SOAP11 );

    op_qname = axutil_qname_create(env,
                    "EventPerformed" ,
                    "http://axis_interface.vsb.cz";,
                    NULL);
    ret_node =  axis2_svc_client_send_receive_with_op_qname( svc_client,
env, op_qname, payload);

    if (!is_soap_act_set)
    {
      axis2_options_set_soap_action(options, env, NULL);
      axis2_options_set_action( options, env, NULL);
    }


        if ( NULL == ret_node )
        {
            return NULL;
        }
        ret_val = adb_EventPerformedResponse_create(env);

        if(adb_EventPerformedResponse_deserialize(ret_val, env,
&ret_node, NULL, AXIS2_FALSE ) == AXIS2_FAILURE)
        {
            if(ret_val != NULL)
            {
              adb_EventPerformedResponse_free(ret_val, env);
            }

            AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted
from the EventPerformedResponse_deserialize: "
                                "This should be due to an invalid XML");
                        return NULL;
        }
        return ret_val;
 }

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to