Return-Path: Delivered-To: apmail-ws-axis-c-user-archive@www.apache.org Received: (qmail 26290 invoked from network); 8 Dec 2008 10:37:38 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 8 Dec 2008 10:37:38 -0000 Received: (qmail 37709 invoked by uid 500); 8 Dec 2008 10:37:46 -0000 Delivered-To: apmail-ws-axis-c-user-archive@ws.apache.org Received: (qmail 37605 invoked by uid 500); 8 Dec 2008 10:37:45 -0000 Mailing-List: contact axis-c-user-help@ws.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: "Apache AXIS C User List" Reply-To: "Apache AXIS C User List" Delivered-To: mailing list axis-c-user@ws.apache.org Received: (qmail 37435 invoked by uid 99); 8 Dec 2008 10:37:45 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Dec 2008 02:37:45 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [213.207.96.134] (HELO mail.quintiq.nl) (213.207.96.134) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Dec 2008 10:36:12 +0000 Received: from DMN_DMZNL-MTA by mail.quintiq.nl with Novell_GroupWise; Mon, 08 Dec 2008 11:37:23 +0100 Message-Id: <493D06D6.6E68.0040.0@quintiq.com> X-Mailer: Novell GroupWise Internet Agent 7.0.3 Date: Mon, 08 Dec 2008 11:36:55 +0100 From: "Patrick van Beem" To: Subject: [axis2/c] When to free what resources in an async adb call? Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-Virus-Checked: Checked by ClamAV on apache.org Hello, I'm planning to use axis a lot in an asynchronous way in a multi-threaded = server environment. Therefore, it is very important for me to not have any = memory (resource) leaks. When using axis in an asynchronous way, I don't = manage to free all my resources in a safe way. I'm using axis2/c with adb = data binding. Here's my problem: Assume I use the following pseudo code: struct resources { axutil_env_t* m_env; axis2_stub_t* m_stub; }; static axis2_status_t AXIS2_CALL on_complete(const axutil_env_t* env, = adb_addResponse_t* response, void* data) { struct resources* res =3D reinterpret_cast(data); /* Use a critical to prevent too early freeing, do some usefull = things.... */ FreeAllocatedResources(res); return AXIS2_SUCCESS; } CalcAsync() { struct resources* res =3D AllocateAndInitializeResources(); adb_add_t* call =3D adb_add_create(res->m_env); /* The real code uses a critical section here to prevent res being freed = before the adb_add_free() is called) */ axis2_stub_start_op_Calculator_add(res->m_stub, res->m_env, call, res, = on_complete, on_error); adb_add_free(call, res->m_env); } The main test program initiates a 100 calls and then just waits. The problem is that when I free the resources in the callback (freeing the = environment and the stub), the system crashes when it exits the thread = created by axis for the async call. But this is the only place I can free = the resources, because it's only here that I know the call finished! What's the usage pattern on freeing resources on async axis calls? Regards, --=20 =20 Patrick van Beem Sr. Software engineer =20 Quintiq =20 T +31 (0) 73 691 07 39 F +31 (0) 73 691 07 54 M +31 (0) 06 15 01 65 83 E patrick.van.beem@quintiq.com I www.quintiq.com This message contains information that may be privileged or confidential = and is the property of Quintiq. It is only intended for the person to whom = it is addressed. If you are not the intended recipient, you are not = authorized to read, print, retain, copy, disseminate, distribute or use = this message or any part thereof. If you have received this message in = error, please notify the sender immediately and delete all copies of this = message. Please note that e-mails are susceptible to change, therefore = they are not binding. --------------------------------------------------------------------- To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org For additional commands, e-mail: axis-c-user-help@ws.apache.org