You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-user@axis.apache.org by martin spurek <ma...@vsb.cz> on 2008/01/23 13:04:10 UTC

memory maangement in generated adb client stub

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: axis-c-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-user-help@ws.apache.org


Re: memory maangement in generated adb client stub

Posted by martin spurek <ma...@vsb.cz>.
Hello. I uset the valgrind tool to get some debug output, however i 
cannot say i understand all the output. I use there one thread to run 
the axis2 related stuff. Just what i noticed where the thread is exiting 
there may be something wrong (i used threads for first time using just 
some examples). However the other informations could be helpful for you...
martin

martin@b4a:~/src/test_client$ valgrind --tool=memcheck 
--leak-check=full  ./test_client
==10853== Memcheck, a memory error detector.
==10853== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
==10853== Using LibVEX rev 1732, a library for dynamic binary translation.
==10853== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
==10853== Using valgrind-3.2.3-Debian, a dynamic binary instrumentation 
framework.
==10853== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.
==10853== For more details, rerun with: -v
==10853==
 - startup of testing client (later to be rebuilt as a demon)...!
AXIS2C_HOME = /home/martin/src_app/axis2c-bin-1.1.0-linux
==10853== Invalid read of size 4
==10853==    at 0x4014AC8: (within /lib/ld-2.6.1.so)
==10853==    by 0x400D015: (within /lib/ld-2.6.1.so)
==10853==    by 0x401099D: (within /lib/ld-2.6.1.so)
==10853==    by 0x41FCC18: (within /lib/tls/i686/cmov/libdl-2.6.1.so)
==10853==    by 0x400D015: (within /lib/ld-2.6.1.so)
==10853==    by 0x41FD2BB: (within /lib/tls/i686/cmov/libdl-2.6.1.so)
==10853==    by 0x41FCB50: dlopen (in /lib/tls/i686/cmov/libdl-2.6.1.so)
==10853==    by 0x420FFA0: axutil_class_loader_load_lib (in 
/usr/lib/libaxutil.so.0)
==10853==    by 0x420FC93: axutil_class_loader_create_dll (in 
/usr/lib/libaxutil.so.0)
==10853==    by 0x40AD95B: axis2_conf_builder_process_transport_recvs 
(in /usr/lib/libaxis2_engine.so.0)
==10853==    by 0x40ABB00: axis2_conf_builder_populate_conf (in 
/usr/lib/libaxis2_engine.so.0)
==10853==    by 0x40A40F2: axis2_dep_engine_load_client (in 
/usr/lib/libaxis2_engine.so.0)
==10853==  Address 0x44149E0 is 72 bytes inside a block of size 74 alloc'd
==10853==    at 0x4022765: malloc (vg_replace_malloc.c:149)
==10853==    by 0x4208033: axutil_allocator_malloc_impl (in 
/usr/lib/libaxutil.so.0)
==10853==    by 0x420B759: axutil_strdup (in /usr/lib/libaxutil.so.0)
==10853==    by 0x42120C7: axutil_dll_desc_set_name (in 
/usr/lib/libaxutil.so.0)
==10853==    by 0x40AD8D6: axis2_conf_builder_process_transport_recvs 
(in /usr/lib/libaxis2_engine.so.0)
==10853==    by 0x40ABB00: axis2_conf_builder_populate_conf (in 
/usr/lib/libaxis2_engine.so.0)
==10853==    by 0x40A40F2: axis2_dep_engine_load_client (in 
/usr/lib/libaxis2_engine.so.0)
==10853==    by 0x40AE955: axis2_build_client_conf_ctx (in 
/usr/lib/libaxis2_engine.so.0)
==10853==    by 0x40BA947: 
axis2_svc_client_init_transports_from_conf_ctx (in 
/usr/lib/libaxis2_engine.so.0)
==10853==    by 0x40B9538: axis2_svc_client_create_with_conf_ctx_and_svc 
(in /usr/lib/libaxis2_engine.so.0)
==10853==    by 0x40B8FC2: axis2_svc_client_create (in 
/usr/lib/libaxis2_engine.so.0)
==10853==    by 0x40B5584: 
axis2_stub_create_with_endpoint_ref_and_client_home (in 
/usr/lib/libaxis2_engine.so.0)
==10853==
==10853== Invalid read of size 4
==10853==    at 0x4014AC8: (within /lib/ld-2.6.1.so)
==10853==    by 0x4007949: (within /lib/ld-2.6.1.so)
==10853==    by 0x4010F83: (within /lib/ld-2.6.1.so)
==10853==    by 0x400D015: (within /lib/ld-2.6.1.so)
==10853==    by 0x401099D: (within /lib/ld-2.6.1.so)
==10853==    by 0x41FCC18: (within /lib/tls/i686/cmov/libdl-2.6.1.so)
==10853==    by 0x400D015: (within /lib/ld-2.6.1.so)
==10853==    by 0x41FD2BB: (within /lib/tls/i686/cmov/libdl-2.6.1.so)
==10853==    by 0x41FCB50: dlopen (in /lib/tls/i686/cmov/libdl-2.6.1.so)
==10853==    by 0x420FFA0: axutil_class_loader_load_lib (in 
/usr/lib/libaxutil.so.0)
==10853==    by 0x420FC93: axutil_class_loader_create_dll (in 
/usr/lib/libaxutil.so.0)
==10853==    by 0x40AD95B: axis2_conf_builder_process_transport_recvs 
(in /usr/lib/libaxis2_engine.so.0)
==10853==  Address 0x44149E0 is 72 bytes inside a block of size 74 alloc'd
==10853==    at 0x4022765: malloc (vg_replace_malloc.c:149)
==10853==    by 0x4208033: axutil_allocator_malloc_impl (in 
/usr/lib/libaxutil.so.0)
==10853==    by 0x420B759: axutil_strdup (in /usr/lib/libaxutil.so.0)
==10853==    by 0x42120C7: axutil_dll_desc_set_name (in 
/usr/lib/libaxutil.so.0)
==10853==    by 0x40AD8D6: axis2_conf_builder_process_transport_recvs 
(in /usr/lib/libaxis2_engine.so.0)
==10853==    by 0x40ABB00: axis2_conf_builder_populate_conf (in 
/usr/lib/libaxis2_engine.so.0)
==10853==    by 0x40A40F2: axis2_dep_engine_load_client (in 
/usr/lib/libaxis2_engine.so.0)
==10853==    by 0x40AE955: axis2_build_client_conf_ctx (in 
/usr/lib/libaxis2_engine.so.0)
==10853==    by 0x40BA947: 
axis2_svc_client_init_transports_from_conf_ctx (in 
/usr/lib/libaxis2_engine.so.0)
==10853==    by 0x40B9538: axis2_svc_client_create_with_conf_ctx_and_svc 
(in /usr/lib/libaxis2_engine.so.0)
==10853==    by 0x40B8FC2: axis2_svc_client_create (in 
/usr/lib/libaxis2_engine.so.0)
==10853==    by 0x40B5584: 
axis2_stub_create_with_endpoint_ref_and_client_home (in 
/usr/lib/libaxis2_engine.so.0)
==10853==
==10853== Invalid read of size 4
==10853==    at 0x4014C20: (within /lib/ld-2.6.1.so)
==10853==    by 0x4007949: (within /lib/ld-2.6.1.so)
==10853==    by 0x4010F83: (within /lib/ld-2.6.1.so)
==10853==    by 0x400D015: (within /lib/ld-2.6.1.so)
==10853==    by 0x401099D: (within /lib/ld-2.6.1.so)
==10853==    by 0x41FCC18: (within /lib/tls/i686/cmov/libdl-2.6.1.so)
==10853==    by 0x400D015: (within /lib/ld-2.6.1.so)
==10853==    by 0x41FD2BB: (within /lib/tls/i686/cmov/libdl-2.6.1.so)
==10853==    by 0x41FCB50: dlopen (in /lib/tls/i686/cmov/libdl-2.6.1.so)
==10853==    by 0x420FFA0: axutil_class_loader_load_lib (in 
/usr/lib/libaxutil.so.0)
==10853==    by 0x420FC93: axutil_class_loader_create_dll (in 
/usr/lib/libaxutil.so.0)
==10853==    by 0x40AD95B: axis2_conf_builder_process_transport_recvs 
(in /usr/lib/libaxis2_engine.so.0)
==10853==  Address 0x44149E0 is 72 bytes inside a block of size 74 alloc'd
==10853==    at 0x4022765: malloc (vg_replace_malloc.c:149)
==10853==    by 0x4208033: axutil_allocator_malloc_impl (in 
/usr/lib/libaxutil.so.0)
==10853==    by 0x420B759: axutil_strdup (in /usr/lib/libaxutil.so.0)
==10853==    by 0x42120C7: axutil_dll_desc_set_name (in 
/usr/lib/libaxutil.so.0)
==10853==    by 0x40AD8D6: axis2_conf_builder_process_transport_recvs 
(in /usr/lib/libaxis2_engine.so.0)
==10853==    by 0x40ABB00: axis2_conf_builder_populate_conf (in 
/usr/lib/libaxis2_engine.so.0)
==10853==    by 0x40A40F2: axis2_dep_engine_load_client (in 
/usr/lib/libaxis2_engine.so.0)
==10853==    by 0x40AE955: axis2_build_client_conf_ctx (in 
/usr/lib/libaxis2_engine.so.0)
==10853==    by 0x40BA947: 
axis2_svc_client_init_transports_from_conf_ctx (in 
/usr/lib/libaxis2_engine.so.0)
==10853==    by 0x40B9538: axis2_svc_client_create_with_conf_ctx_and_svc 
(in /usr/lib/libaxis2_engine.so.0)
==10853==    by 0x40B8FC2: axis2_svc_client_create (in 
/usr/lib/libaxis2_engine.so.0)
==10853==    by 0x40B5584: 
axis2_stub_create_with_endpoint_ref_and_client_home (in 
/usr/lib/libaxis2_engine.so.0)
==10853==
==10853== Invalid read of size 4
==10853==    at 0x4014C20: (within /lib/ld-2.6.1.so)
==10853==    by 0x4005BE9: (within /lib/ld-2.6.1.so)
==10853==    by 0x4007A07: (within /lib/ld-2.6.1.so)
==10853==    by 0x4010F83: (within /lib/ld-2.6.1.so)
==10853==    by 0x400D015: (within /lib/ld-2.6.1.so)
==10853==    by 0x401099D: (within /lib/ld-2.6.1.so)
==10853==    by 0x41FCC18: (within /lib/tls/i686/cmov/libdl-2.6.1.so)
==10853==    by 0x400D015: (within /lib/ld-2.6.1.so)
==10853==    by 0x41FD2BB: (within /lib/tls/i686/cmov/libdl-2.6.1.so)
==10853==    by 0x41FCB50: dlopen (in /lib/tls/i686/cmov/libdl-2.6.1.so)
==10853==    by 0x420FFA0: axutil_class_loader_load_lib (in 
/usr/lib/libaxutil.so.0)
==10853==    by 0x420FC93: axutil_class_loader_create_dll (in 
/usr/lib/libaxutil.so.0)
==10853==  Address 0x44149E0 is 72 bytes inside a block of size 74 alloc'd
==10853==    at 0x4022765: malloc (vg_replace_malloc.c:149)
==10853==    by 0x4208033: axutil_allocator_malloc_impl (in 
/usr/lib/libaxutil.so.0)
==10853==    by 0x420B759: axutil_strdup (in /usr/lib/libaxutil.so.0)
==10853==    by 0x42120C7: axutil_dll_desc_set_name (in 
/usr/lib/libaxutil.so.0)
==10853==    by 0x40AD8D6: axis2_conf_builder_process_transport_recvs 
(in /usr/lib/libaxis2_engine.so.0)
==10853==    by 0x40ABB00: axis2_conf_builder_populate_conf (in 
/usr/lib/libaxis2_engine.so.0)
==10853==    by 0x40A40F2: axis2_dep_engine_load_client (in 
/usr/lib/libaxis2_engine.so.0)
==10853==    by 0x40AE955: axis2_build_client_conf_ctx (in 
/usr/lib/libaxis2_engine.so.0)
==10853==    by 0x40BA947: 
axis2_svc_client_init_transports_from_conf_ctx (in 
/usr/lib/libaxis2_engine.so.0)
==10853==    by 0x40B9538: axis2_svc_client_create_with_conf_ctx_and_svc 
(in /usr/lib/libaxis2_engine.so.0)
==10853==    by 0x40B8FC2: axis2_svc_client_create (in 
/usr/lib/libaxis2_engine.so.0)
==10853==    by 0x40B5584: 
axis2_stub_create_with_endpoint_ref_and_client_home (in 
/usr/lib/libaxis2_engine.so.0)
GENERATE some ID... xyz-testData
BUFFER FULL ... or collector time-out
What to do...
BUFFER SWAP
CLIENT-AXIS2 THREAD CALLED...
CLIENT AXIS2 sendout - buffer used:  1!!!
CLIENT AXIS2 sendout - single event...
 DTO create...
CLIENT AXIS2 sendout - single event... Wed Jan 23 23:32:24 2008
 xyz-testData testing__1
  event performed create...
!!! AXIS2 STUB Service. - null soap action
==10853==
==10853== Thread 2:
==10853== Invalid read of size 4
==10853==    at 0x4014C09: (within /lib/ld-2.6.1.so)
==10853==    by 0x4005BE9: (within /lib/ld-2.6.1.so)
==10853==    by 0x4007A07: (within /lib/ld-2.6.1.so)
==10853==    by 0x4010F83: (within /lib/ld-2.6.1.so)
==10853==    by 0x400D015: (within /lib/ld-2.6.1.so)
==10853==    by 0x401099D: (within /lib/ld-2.6.1.so)
==10853==    by 0x4348061: (within /lib/tls/i686/cmov/libc-2.6.1.so)
==10853==    by 0x400D015: (within /lib/ld-2.6.1.so)
==10853==    by 0x4348224: __libc_dlopen_mode (in 
/lib/tls/i686/cmov/libc-2.6.1.so)
==10853==    by 0x4322756: __nss_lookup_function (in 
/lib/tls/i686/cmov/libc-2.6.1.so)
==10853==    by 0x432286F: (within /lib/tls/i686/cmov/libc-2.6.1.so)
==10853==    by 0x4324495: __nss_hosts_lookup (in 
/lib/tls/i686/cmov/libc-2.6.1.so)
==10853==  Address 0x4535FA4 is 36 bytes inside a block of size 37 alloc'd
==10853==    at 0x4022765: malloc (vg_replace_malloc.c:149)
==10853==    by 0x4007FA1: (within /lib/ld-2.6.1.so)
==10853==    by 0x4010F83: (within /lib/ld-2.6.1.so)
==10853==    by 0x400D015: (within /lib/ld-2.6.1.so)
==10853==    by 0x401099D: (within /lib/ld-2.6.1.so)
==10853==    by 0x4348061: (within /lib/tls/i686/cmov/libc-2.6.1.so)
==10853==    by 0x400D015: (within /lib/ld-2.6.1.so)
==10853==    by 0x4348224: __libc_dlopen_mode (in 
/lib/tls/i686/cmov/libc-2.6.1.so)
==10853==    by 0x4322756: __nss_lookup_function (in 
/lib/tls/i686/cmov/libc-2.6.1.so)
==10853==    by 0x432286F: (within /lib/tls/i686/cmov/libc-2.6.1.so)
==10853==    by 0x4324495: __nss_hosts_lookup (in 
/lib/tls/i686/cmov/libc-2.6.1.so)
==10853==    by 0x4328A52: gethostbyname_r (in 
/lib/tls/i686/cmov/libc-2.6.1.so)
        - payload is not NULL...
        - options is not NULL...
        - svc_client is not NULL...
        - soap_action is not NULL...
        - op_qname is not NULL...
!!! AXIS2 STUB Service. - before return 2...
CLIENT - SEND SINGLE EVENT -
        !!! the service is not reachable at expected URI (wrong URI, 
service not is running or network connection failed)...
CLIENT-AXIS2 THREAD EXIT...
==10853==
==10853== Invalid read of size 4
==10853==    at 0x4014BF3: (within /lib/ld-2.6.1.so)
==10853==    by 0x4005BE9: (within /lib/ld-2.6.1.so)
==10853==    by 0x4007A07: (within /lib/ld-2.6.1.so)
==10853==    by 0x4010F83: (within /lib/ld-2.6.1.so)
==10853==    by 0x400D015: (within /lib/ld-2.6.1.so)
==10853==    by 0x401099D: (within /lib/ld-2.6.1.so)
==10853==    by 0x4348061: (within /lib/tls/i686/cmov/libc-2.6.1.so)
==10853==    by 0x400D015: (within /lib/ld-2.6.1.so)
==10853==    by 0x4348224: __libc_dlopen_mode (in 
/lib/tls/i686/cmov/libc-2.6.1.so)
==10853==    by 0x4233EE6: pthread_cancel_init (in 
/lib/tls/i686/cmov/libpthread-2.6.1.so)
==10853==    by 0x4234010: _Unwind_ForcedUnwind (in 
/lib/tls/i686/cmov/libpthread-2.6.1.so)
==10853==    by 0x4231AE0: __pthread_unwind (in 
/lib/tls/i686/cmov/libpthread-2.6.1.so)
==10853==  Address 0x45369B8 is 16 bytes inside a block of size 19 alloc'd
==10853==    at 0x4022765: malloc (vg_replace_malloc.c:149)
==10853==    by 0x4007FA1: (within /lib/ld-2.6.1.so)
==10853==    by 0x4010F83: (within /lib/ld-2.6.1.so)
==10853==    by 0x400D015: (within /lib/ld-2.6.1.so)
==10853==    by 0x401099D: (within /lib/ld-2.6.1.so)
==10853==    by 0x4348061: (within /lib/tls/i686/cmov/libc-2.6.1.so)
==10853==    by 0x400D015: (within /lib/ld-2.6.1.so)
==10853==    by 0x4348224: __libc_dlopen_mode (in 
/lib/tls/i686/cmov/libc-2.6.1.so)
==10853==    by 0x4233EE6: pthread_cancel_init (in 
/lib/tls/i686/cmov/libpthread-2.6.1.so)
==10853==    by 0x4234010: _Unwind_ForcedUnwind (in 
/lib/tls/i686/cmov/libpthread-2.6.1.so)
==10853==    by 0x4231AE0: __pthread_unwind (in 
/lib/tls/i686/cmov/libpthread-2.6.1.so)
==10853==    by 0x422C53F: pthread_exit (in 
/lib/tls/i686/cmov/libpthread-2.6.1.so)
GENERATE null ID, reset test counter...
GENERATE some ID... xyz-testData
BUFFER FULL ... or collector time-out
What to do...
BUFFER SWAP
CLIENT-AXIS2 THREAD CALLED...
CLIENT AXIS2 sendout - buffer used:  1!!!
CLIENT AXIS2 sendout - single event...
CLIENT AXIS2 sendout - single event... Wed Jan 23 23:32:39 2008
 xyz-testData testing__1
!!! AXIS2 STUB Service. - null soap action
        - payload is not NULL...
        - options is not NULL...
        - svc_client is not NULL...
        - soap_action is not NULL...
        - op_qname is not NULL...
!!! AXIS2 STUB Service. - before return 2...
CLIENT - SEND SINGLE EVENT -
        !!! the service is not reachable at expected URI (wrong URI, 
service not is running or network connection failed)...
CLIENT-AXIS2 THREAD EXIT...
GENERATE null ID, reset test counter...
GENERATE some ID... xyz-testData
BUFFER FULL ... or collector time-out
What to do...
BUFFER SWAP
CLIENT-AXIS2 THREAD CALLED...
CLIENT AXIS2 sendout - buffer used:  1!!!
CLIENT AXIS2 sendout - single event...
CLIENT AXIS2 sendout - single event... Wed Jan 23 23:32:49 2008
 xyz-testData testing__1
!!! AXIS2 STUB Service. - null soap action
        - payload is not NULL...
        - options is not NULL...
        - svc_client is not NULL...
        - soap_action is not NULL...
        - op_qname is not NULL...
!!! AXIS2 STUB Service. - before return 2...
CLIENT - SEND SINGLE EVENT -
        !!! the service is not reachable at expected URI (wrong URI, 
service not is running or network connection failed)...
CLIENT-AXIS2 THREAD EXIT...
GENERATE null ID, reset test counter...
GENERATE some ID... xyz-testData
BUFFER FULL ... or collector time-out
What to do...
BUFFER SWAP
CLIENT-AXIS2 THREAD CALLED...
CLIENT AXIS2 sendout - buffer used:  1!!!
CLIENT AXIS2 sendout - single event...
CLIENT AXIS2 sendout - single event... Wed Jan 23 23:32:58 2008
 xyz-testData testing__1
!!! AXIS2 STUB Service. - null soap action
        - payload is not NULL...
        - options is not NULL...
        - svc_client is not NULL...
        - soap_action is not NULL...
        - op_qname is not NULL...
!!! AXIS2 STUB Service. - before return 2...
CLIENT - SEND SINGLE EVENT -
        !!! the service is not reachable at expected URI (wrong URI, 
service not is running or network connection failed)...
CLIENT-AXIS2 THREAD EXIT...
GENERATE null ID, reset test counter...
GENERATE some ID... xyz-testData
BUFFER FULL ... or collector time-out
What to do...
BUFFER SWAP
CLIENT-AXIS2 THREAD CALLED...
CLIENT AXIS2 sendout - buffer used:  1!!!
CLIENT AXIS2 sendout - single event...
CLIENT AXIS2 sendout - single event... Wed Jan 23 23:33:08 2008
 xyz-testData testing__1
!!! AXIS2 STUB Service. - null soap action
        - payload is not NULL...
        - options is not NULL...
        - svc_client is not NULL...
        - soap_action is not NULL...
        - op_qname is not NULL...
!!! AXIS2 STUB Service. - before return 2...
CLIENT - SEND SINGLE EVENT -
        !!! the service is not reachable at expected URI (wrong URI, 
service not is running or network connection failed)...
CLIENT-AXIS2 THREAD EXIT...
GENERATE null ID, reset test counter...
GENERATE some ID... xyz-testData
BUFFER FULL ... or collector time-out
What to do...
BUFFER SWAP
CLIENT-AXIS2 THREAD CALLED...
CLIENT AXIS2 sendout - buffer used:  1!!!
CLIENT AXIS2 sendout - single event...
CLIENT AXIS2 sendout - single event... Wed Jan 23 23:33:17 2008
 xyz-testData testing__1
!!! AXIS2 STUB Service. - null soap action
        - payload is not NULL...
        - options is not NULL...
        - svc_client is not NULL...
        - soap_action is not NULL...
        - op_qname is not NULL...
!!! AXIS2 STUB Service. - before return 2...
CLIENT - SEND SINGLE EVENT -
        !!! the service is not reachable at expected URI (wrong URI, 
service not is running or network connection failed)...
CLIENT-AXIS2 THREAD EXIT...
CTRL+C pressed (Catched signal: 2)
Cleaning threads stuff...
Axis2 deinitialize...
Cleaning event buffers...
Exiting...
==10853==
==10853== Thread 1:
==10853== Invalid free() / delete / delete[]
==10853==    at 0x402237F: free (vg_replace_malloc.c:233)
==10853==    by 0x4351AFB: (within /lib/tls/i686/cmov/libc-2.6.1.so)
==10853==    by 0x4351643: __libc_freeres (in 
/lib/tls/i686/cmov/libc-2.6.1.so)
==10853==    by 0x401E216: _vgnU_freeres (vg_preloaded.c:60)
==10853==    by 0x42D1233: _Exit (in /lib/tls/i686/cmov/libc-2.6.1.so)
==10853==    by 0x4254057: (below main) (in 
/lib/tls/i686/cmov/libc-2.6.1.so)
==10853==  Address 0x4388008 is not stack'd, malloc'd or (recently) free'd
==10853==
==10853== ERROR SUMMARY: 8 errors from 7 contexts (suppressed: 59 from 1)
==10853== malloc/free: in use at exit: 686,571 bytes in 7,855 blocks.
==10853== malloc/free: 12,055 allocs, 4,201 frees, 925,298 bytes allocated.
==10853== For counts of detected errors, rerun with: -v
==10853== searching for pointers to 7,855 not-freed blocks.
==10853== checked 8,896,412 bytes.
==10853==
==10853==
==10853== 136 bytes in 1 blocks are possibly lost in loss record 5 of 46
==10853==    at 0x4021AA4: calloc (vg_replace_malloc.c:279)
==10853==    by 0x4010067: (within /lib/ld-2.6.1.so)
==10853==    by 0x401012B: _dl_allocate_tls (in /lib/ld-2.6.1.so)
==10853==    by 0x422BBA3: pthread_create@@GLIBC_2.1 (in 
/lib/tls/i686/cmov/libpthread-2.6.1.so)
==10853==    by 0x8056D35: main (CLIENT_era_client.c:190)
==10853==
==10853==
==10853== 144 bytes in 6 blocks are definitely lost in loss record 6 of 46
==10853==    at 0x4022765: malloc (vg_replace_malloc.c:149)
==10853==    by 0x415C884: xmlNewMutex (in /usr/lib/libxml2.so.2.6.30)
==10853==    by 0x415C226: xmlInitGlobals (in /usr/lib/libxml2.so.2.6.30)
==10853==    by 0x415C426: xmlInitializeGlobalState (in 
/usr/lib/libxml2.so.2.6.30)
==10853==    by 0x415C94D: xmlGetGlobalState (in /usr/lib/libxml2.so.2.6.30)
==10853==    by 0x415B92B: __xmlGenericError (in /usr/lib/libxml2.so.2.6.30)
==10853==    by 0x40F21C4: xmlInitParser (in /usr/lib/libxml2.so.2.6.30)
==10853==    by 0x43930AB: axiom_xml_reader_init (in 
/usr/lib/libaxis2_parser.so.0)
==10853==    by 0x40B6EE2: axis2_op_client_create (in 
/usr/lib/libaxis2_engine.so.0)
==10853==    by 0x40BA7E6: axis2_svc_client_create_op_client (in 
/usr/lib/libaxis2_engine.so.0)
==10853==    by 0x40BA2A8: axis2_svc_client_send_receive_with_op_qname 
(in /usr/lib/libaxis2_engine.so.0)
==10853==    by 0x8057DEF: axis2_stub_op_CLIENT_Service_EventPerformed 
(in /home/martin/src/CLIENT_era_client/CLIENT__client)
==10853==
==10853==
==10853== 25,949 (5,806 direct, 20,143 indirect) bytes in 76 blocks are 
definitely lost in loss record 41 of 46
==10853==    at 0x4022765: malloc (vg_replace_malloc.c:149)
==10853==    by 0x4208033: axutil_allocator_malloc_impl (in 
/usr/lib/libaxutil.so.0)
==10853==    by 0x409C7ED: axis2_msg_create (in 
/usr/lib/libaxis2_engine.so.0)
==10853==    by 0x40931E2: axis2_op_create (in 
/usr/lib/libaxis2_engine.so.0)
==10853==    by 0x409358C: axis2_op_create_with_qname (in 
/usr/lib/libaxis2_engine.so.0)
==10853==    by 0x8057326: 
axis2_stub_populate_services_for_CLIENT_Service (in 
/home/martin/src/CLIENT_era_client/CLIENT__client)
==10853==    by 0x805719D: axis2_stub_create_CLIENT_Service (in 
/home/martin/src/CLIENT_era_client/CLIENT__client)
==10853==    by 0x8056A48: icics_axis2_initialize (in 
/home/martin/src/CLIENT_era_client/CLIENT__client)
==10853==    by 0x8056B6C: main (CLIENT_era_client.c:119)
==10853==
==10853== LEAK SUMMARY:
==10853==    definitely lost: 5,950 bytes in 82 blocks.
==10853==    indirectly lost: 20,143 bytes in 273 blocks.
==10853==      possibly lost: 136 bytes in 1 blocks.
==10853==    still reachable: 660,342 bytes in 7,499 blocks.
==10853==         suppressed: 0 bytes in 0 blocks.
==10853== Reachable blocks (those to which a pointer was found) are not 
shown.
==10853== To see them, rerun with: --leak-check=full --show-reachable=yes


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


Re: memory maangement in generated adb client stub

Posted by martin spurek <ma...@vsb.cz>.
Hi.
I can try do the testing. I am not developing in c  so often so i am not 
so experienced, I did not have need use such tool you mentioned yet. If 
i will find something i will post it here.
martin

Dimuthu Gamage wrote:
> On Jan 23, 2008 7:41 PM, martin spurek <ma...@vsb.cz> wrote:
>   
>> 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?
>>     
>
> No, you don't have to. it will be freed when the request/response adb is freed,
>
> ) + 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...).
>>     
>
> Yea, I have not tested the memory management stuff on codegen
> recently. It will be helpful if you can support on this with a tool
> like valgrind or purify locating where the leaks are.
>
> Thanks
> Dimuthu
>   

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


Re: memory maangement in generated adb client stub

Posted by Dimuthu Gamage <di...@gmail.com>.
On Jan 23, 2008 7:41 PM, martin spurek <ma...@vsb.cz> wrote:
> 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?

No, you don't have to. it will be freed when the request/response adb is freed,

) + 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...).

Yea, I have not tested the memory management stuff on codegen
recently. It will be helpful if you can support on this with a tool
like valgrind or purify locating where the leaks are.

Thanks
Dimuthu

> 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 <ma...@vsb.cz> 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: 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
> >
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> 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


Re: memory maangement in generated adb client stub

Posted by martin spurek <ma...@vsb.cz>.
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 <ma...@vsb.cz> 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: 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
>
>
>
>   


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


Re: memory maangement in generated adb client stub

Posted by Dimuthu Gamage <di...@gmail.com>.
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 <ma...@vsb.cz> 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: 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