|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
OutputNode in C -> Memory problem |
« View previous topic :: View next topic » |
Author |
Message
|
marco |
Posted: Mon Jul 10, 2006 3:23 am Post subject: OutputNode in C -> Memory problem |
|
|
Apprentice
Joined: 16 Feb 2004 Posts: 46
|
Hi,
I've created a simple outputNode in C, it runs through the environment of the messages and logs an event in the windows EventViewer.
Since I had a memory problem I began to strip the evaluate function, because initial tests proved it was here that the problem was.
I've stripped my function down to the following code, but I still loose about 10Mb over 10.000 messages, which is of course not done ...
I mostly suspect the cniElementName or cniElementCharacterValue call
Any help would be great !!
void evaluate(CciContext *context, CciMessage *destinationList, CciMessage *exceptionList, CciMessage *message)
{
CCI_EXCEPTION_ST exception_st;
int rc = 0;
int retvalue = 1;
const CciChar elementName[256];
const CciChar elementValue[1028];
CciTerminal *outputTerminalObject = NULL;
CciElement *rootElement = NULL;
CciElement *envElement = NULL;
CciElement *testElement = NULL;
CciMessage *environment = NULL;
const char *str_eName;
const char *str_eValue;
if(DEBUG) Log("in evaluate",NULL);
environment = cniGetEnvironmentMessage(&rc,message);
envElement = cniRootElement(&rc, environment);
checkRC(rc);
if(DEBUG) Log("got the root of the environment",NULL);
testElement = cniSearchFirstChild(&rc,envElement,CCI_COMPARE_MODE_NAME ,0,L"Variables");
checkRC(rc);
if(testElement == NULL)
if(DEBUG) Log("Element Variables not found",NULL);
if(DEBUG) Log("got element Variables",NULL);
testElement = cniSearchFirstChild(&rc,testElement,CCI_COMPARE_MODE_NAME ,0,L"Event");
checkRC(rc);
if(testElement == NULL)
if(DEBUG) Log("Element Event not found",NULL);
testElement = cniFirstChild(&rc, testElement);
if(DEBUG) Log("got first child of Event",NULL);
if(DEBUG) Log("searching through Event structure",NULL);
while (testElement) {
cniElementName(&rc, testElement, elementName, 256);
checkRC(rc);
if (rc == CCI_BUFFER_TOO_SMALL) {
Log("buffer was too small",NULL);
}
str_eName = mbString(elementName,BIP_DEF_COMP_CCSID);
if(DEBUG) Log("elementName : ",(char*)str_eName);
cniElementCharacterValue(&rc,testElement,elementValue,1028 );
checkRC(rc);
if (rc == CCI_BUFFER_TOO_SMALL) {
Log("buffer was too small",NULL);
}
str_eValue = mbString(elementValue,BIP_DEF_COMP_CCSID);
if(DEBUG) Log("elementValue : ",(char*)str_eValue);
testElement = cniNextSibling(&rc, testElement);
if(DEBUG) Log("freeïng eValue en eName",NULL);
free((void*)str_eName);
free((void*)str_eValue);
}
cniFinalize(&rc, message, CCI_FINALIZE_NONE);
outputTerminalObject = getOutputTerminalHandle(context, (CciChar*)constOut);
if (outputTerminalObject) {
if (cniIsTerminalAttached(&rc, outputTerminalObject))
{
if (rc == CCI_SUCCESS)
{
if(DEBUG) Log("terminal was attached",NULL);
retvalue = cniPropagate(&rc, outputTerminalObject, destinationList, exceptionList, message);
if (rc != CCI_SUCCESS)
{
if (rc == CCI_EXCEPTION)
{
memset(&exception_st, 0, sizeof(exception_st));
cciGetLastExceptionData(&rc, &exception_st);
cciRethrowLastException(&rc);
}
}
}
else {
if (rc == CCI_EXCEPTION) {
if(DEBUG) Log("rethrowing",NULL);
cciRethrowLastException(&rc);
}
}
}
else
{
if(DEBUG) Log("terminal was not attached... ",NULL);
cciRethrowLastException(&rc);
}
}
return;
} |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|