[omniORB] TypeCode_var equivalent memory leak
Michael Shearer
mshearer at aastra.com
Tue Apr 13 13:05:25 BST 2004
Alex,
Thanks! That did the trick.
Mike
-----Original Message-----
From: Alex Tingle [mailto:alex.tingle at bronermetals.com]
Sent: Tuesday, April 13, 2004 11:28 AM
To: Michael Shearer
Cc: omniorb-list at omniorb-support.com
Subject: Re: [omniORB] TypeCode_var equivalent memory leak
Mike,
> (eventQueuesM[SourceQ].queue.back().type()->equivalent(Event.type())) )
> <<<<===== This is where it leaks
Any::type() manufactures a TypeCode_ptr for you - you are responsible
for releasing it.
Try this instead:
if( (!eventQueuesM[SourceQ].queue.empty()) )
{
CORBA::TypeCode_var backTc
=eventQueuesM[SourceQ].queue.back().type();
CORBA::TypeCode_var eventTc =Event.type();
if( backTc->equivalent(eventTc) )
{
...
regards,
-Alex Tingle
--
Dammit Jim, I'm a programmer... not a mind reader!
On 13 Apr 2004, at 16:05, Michael Shearer wrote:
> Hi!
>
> I'm having problems figuring out why the following bit of code leaks.
> For some reason, the TypeCode equivalent primitive seems to be
> allocating memory, is this correct behaviour? Am I doing something
> wrong?
>
> I would appreciate any help!
>
> Thanks,
>
> Mike
>
> CORBA::Any* EventMgr_impl::pull( const CORBA::Any& Event,
> Event::queueName_t SourceQ )
> {
> METHODTRACE( "CORBA::Any* EventMgr_impl::pull( const
> CORBA::Any&
> Event, Event::queueName_t SourceQ )" );
>
> CORBA::Any event;
>
> if( (SourceQ < Event::MAX_EVENT_QUEUE) &&
> (SourceQ != Event::NULLQ) )
> {
> if( (!eventQueuesM[SourceQ].queue.empty()) &&
>
> (eventQueuesM[SourceQ].queue.back().type()->equivalent(Event.type())) )
> <<<<===== This is where it leaks
>
> {
> eventQueuesM[SourceQ].notified = FALSE;
> event = eventQueuesM[SourceQ].queue.back();
> eventQueuesM[SourceQ].queue.pop_back();
> return new CORBA::Any(event);
> }
> else
> return NULL;
> }
> else
> {
> LogError("Received pull for unknown queue.");
> throw Event::EventProxy::invalidQ();
> }
> }
>
> Michael Shearer
> CVX SS7 Gateway (CSG) Engineer
> Aastra Telecom US, CVX Division
> 8 Federal Street
> Billerica, MA, USA, 01821-3570
> * Phone (978) 436-4248
> * Fax (978) 436-4233
> * Internet Mail mshearer at aastra.com
> * Web www.aastra.com
>
> <ATT145023.txt>
More information about the omniORB-list
mailing list