Hi,
I am trying to solve a few memory leaks with Axis2c. I am not sure if any of
these are false positives. I am using valgrind to detect the leaks.
==1265== 1 bytes in 1 blocks are definitely lost in loss record 1 of 17
==1265== at 0x4005BDC: malloc (vg_replace_malloc.c:195)
==1265== by 0x4012CAC: axutil_allocator_malloc_impl (allocator.c:99)
==1265== by 0x403DDEE: axiom_element_declare_namespace (om_element.c:469)
==1265== by 0x403E328: axiom_element_set_namespace (om_element.c:575)
==1265== by 0x403FBE8: axiom_element_create (om_element.c:121)
==1265== by 0x80494C4: create_custom_header(axutil_env const*)
(hello.cpp:210)
==1265== by 0x8048FDD: main (hello.cpp:66)
I am basically creating a custom header.
hello.cpp:210 :
create_custom_heade()
{
custom_header_ele = axiom_element_create(env, NULL, "MeHeader", ns1,
&custom_header_node);
....
return custom_header_node
}
This element is not used any where in the source, its the element of the
base node created which participates in creating a custom header as follows
main()
{
axis2_svc_client_add_header(svc_client,env,create_custom_header(env));
}
So are such elements required to be freed ?
==1552== 94 (16 direct, 78 indirect) bytes in 1 blocks are definitely lost
in loss record 12 of 14
==1552== at 0x4005BDC: malloc (vg_replace_malloc.c:195)
==1552== by 0x4012CAC: axutil_allocator_malloc_impl (allocator.c:99)
==1552== by 0x4041419: axiom_namespace_create (om_namespace.c:49)
==1552== by 0x404B0D2: axiom_soap_envelope_create (soap_envelope.c:86)
==1552== by 0x404B3D6: axiom_soap_envelope_create_default_soap_envelope
(soap_envelope.c:460)
==1552== by 0x40AEE83: axis2_svc_client_fill_soap_envelope
(svc_client.c:1248)
==1552== by 0x40AF805: axis2_svc_client_send_receive_with_op_qname
(svc_client.c:698)
==1552== by 0x40AFAD2: axis2_svc_client_send_receive (svc_client.c:797)
==1552== by 0x8049051: main (hello.cpp:68)
This second leak seems to originate from the engine.
soap_envelope.c:
axiom_soap_envelope_create:86
ns2 =axiom_namespace_create(env, "http://www.w3.org/1999/XMLSchema-instance",
"xsi");
ns3 =axiom_namespace_create(env, "http://www.w3.org/2001/XMLSchema","xsd");
Used as
axiom_element_declare_namespace(ele,env,soap_envelope->om_ele_node,ns2);
axiom_element_declare_namespace(ele,env,soap_envelope->om_ele_node,ns3);
/**
* Declare a namespace in current element (in the scope of this element ).
* It checks to see if it is already declared at this level or in its
ancestors
* @param om_element contained in the om node struct
* @param env Environment. MUST NOT be NULL.
* @param node node containing an instance of an AXIOM element.
* @param ns pointer to the namespace struct to be declared. Should not be
null
* @return status of the operation. AXIS2_SUCCESS on success else
AXIS2_FAILURE.
*/
i.e it builds a hash of the namespace.
Are these required to be freed as well ? I tried freeing them and building
the libs & client/server. I do not notice any faults, i wanted to confirm i
was not stepping over on this case.
Please let me know.
Cheers!