[openamq-dev] Subscriber memory management problems
Aamir
aamirjvm at gmail.com
Tue Feb 26 00:15:14 CET 2008
Dear All,
I have adapted the Chatroom example to a very simple sender /
reciever demo. Please see the attached code. The reciever code
(WireAPI_Sub.cpp) appears to have a serious memory leak that is
related to amq_content_basic_get_body() ...
I am using:
* Visual Studio 2005 for writing the client apps
* Win32 build (Multi-threaded Debug) of OpenAMQ from wiki.openamq.org
* I compile my client apps by linking to the .lib found in the Win32 build
When I run the attached example code, the memory used by
WireAPI_Sub.cpp grows very rapidly and keeps growing (i.e. memory
leak). As far as I can, the basic logic of my programs is identical to
the OpenAMQ Chatroom example. Could this memory leak be a result of
using the compiled server and libraries provided in "Win32 build with
DLLs," instead of building OpenAMQ myself? Or is it because of my
client code ... is there some memory deallocation that I'm supposed to
be doing in the while loop?
On a related note, there is a commented line in WireAPI_Sub.cpp which
says "delete [] buffer" ... If I uncomment this line and run the code,
I get the following error in VC++ at run-time: "Debug Assertion
Failed! Program: WireAPI_Sub.exe, File:
f:\dd\vctools\crt_bld\self_x86\dbgdel.cpp, Line 52, Expression:
_BLOCK_TYPE_IS_VALID(pHead->nBlockUse)" ... The VC++ dialog box gives
me three options: Abort, Retry, and Ignore. If I click Abort then
first amq_server.exe itself crashes (!), giving the following message:
"2008-02-25 17:53:40: (smt_socket_request.c 2490) A non-blocking
socket operation could not be completed immediately.
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information."
It is extremely distressing that my client code is
able to crash the AMQP server. Is the OpenAMQ server designed to be
stable no matter what the client code does? Or is it just accepted
that a bug in a single client could stop the whole show?
Thanks,
Aamir
P.S. Please excuse the text formatting in the attachments
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: WireAPI_Pub.cpp
Url: http://lists.openamq.org/pipermail/openamq-dev/attachments/20080225/dc5010af/attachment.txt
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: WireAPI_Sub.cpp
Url: http://lists.openamq.org/pipermail/openamq-dev/attachments/20080225/dc5010af/attachment-0001.txt
More information about the openamq-dev
mailing list