>Hi,
>I also noticed that in the documentation there is a mention that the
>previous exitBuffer address is returned in the next invocation of the
>message exit, so I guess I can free the memory then...That should be
>fine...but in any case if there is something wrong with this approach...or
>if there is any other way ...that would be nice to know.

>Thanks
>Kind Regards
>Aby Philip

Aby,

No this isn't really the right solution. You are not guaranteed to be
called again with MQXR_MSG and therefore this could leak.

Exits are always passed a Channel Exit Parameter structure containing a 16
byte field ExitUserArea. This field should be used to store a pointer to
any state information the exit may have. This is really true for all exits.
The reason it is 16 bytes is that OS/400 has 16 byte pointers.

In your case the state information is the Exit buffer address. I would
recommend you allocate a structure for all your state information at
MQXR_INIT time. One of the fields in this structure would be a place for
you to store your exit buffer pointer if you've allocated one. Perhaps you
might also want to store things like the length of the buffer etc. At
MQXR_TERM time you should look to see whether this buffer pointer has been
set and if so free it and then free the state structure itself.

Hope this helps,
P.

Paul G Clarke
WebSphere MQ Development
IBM Hursley

Instructions for managing your mailing list subscription are provided in
the Listserv General Users Guide available at http://www.lsoft.com
Archive: http://vm.akh-wien.ac.at/MQSeries.archive

Reply via email to