Object Pooling questions 
Author Message
 Object Pooling questions

I know that FinalRelease() is not called after a method call on a
pooled object, it keeps the object in memory for later use.  However,
shouldn't it be called when MTS destroys the object?  So if the object
is destroyed because the application is shutdown either by idle or
manual means shouldn't MTS call FinalRelease() at that point?

I have an ATL COM object that is not calling FinalRelease() ever so
when the application shuts down due to the application being idle the
resources are not being released.  If FinalRelease() is never called
when objects are pooled than how do you release resources when the
object is destroyed?

Thanks for your help,
Aaron Long



Mon, 05 Jul 2004 01:41:28 GMT  
 Object Pooling questions
FinalRelease is called in the destructor of CComObject<>. That is
called from "delete this" in the implementation of Release in the
same class. If your FinalRelease is not called, but the object is
indeed destroyed, that means exactly one thing - the signature of
your FinalRelease method is incorrect. Release calls the default
FinalRelease which does nothing.

--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD

MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================

Quote:

> I know that FinalRelease() is not called after a method call on a
> pooled object, it keeps the object in memory for later use.  However,
> shouldn't it be called when MTS destroys the object?  So if the object
> is destroyed because the application is shutdown either by idle or
> manual means shouldn't MTS call FinalRelease() at that point?

> I have an ATL COM object that is not calling FinalRelease() ever so
> when the application shuts down due to the application being idle the
> resources are not being released.  If FinalRelease() is never called
> when objects are pooled than how do you release resources when the
> object is destroyed?

> Thanks for your help,
> Aaron Long



Mon, 05 Jul 2004 03:47:00 GMT  
 Object Pooling questions
Thank you for your help.

I believe I have the function defined correctly.
Here is how I have FinalRelease defined.

[Method Definition]
void CBroadcast::FinalRelease()
{
   ... delete some internal objects.
   ... write a few log messages.

Quote:
}

[Class Definition]
// IBroadcast
public:
        ...
        HRESULT FinalConstruct();
        void FinalRelease();
        ...

Do you see any problems?  Again, FinalRelease will be called when the
object is not pooled, but it is still running in MTS.  Is there a
special way to define FinalRelease when you use object pooling?  I am
assuming that the object is destroyed because I have explicity shut
down the MTS package, but the resources are not being freed and the
log files are not being written to as they are when pooling is
disabled.

Thanks for your help again.
Aaron

Quote:

> FinalRelease is called in the destructor of CComObject<>. That is
> called from "delete this" in the implementation of Release in the
> same class. If your FinalRelease is not called, but the object is
> indeed destroyed, that means exactly one thing - the signature of
> your FinalRelease method is incorrect. Release calls the default
> FinalRelease which does nothing.

> --
> =========================
> ============
> Alexander Nickolov
> Microsoft MVP [VC], MCSD

> MVP VC FAQ: http://www.mvps.org/vcfaq
> =========================
> ============



> > I know that FinalRelease() is not called after a method call on a
> > pooled object, it keeps the object in memory for later use.  However,
> > shouldn't it be called when MTS destroys the object?  So if the object
> > is destroyed because the application is shutdown either by idle or
> > manual means shouldn't MTS call FinalRelease() at that point?

> > I have an ATL COM object that is not calling FinalRelease() ever so
> > when the application shuts down due to the application being idle the
> > resources are not being released.  If FinalRelease() is never called
> > when objects are pooled than how do you release resources when the
> > object is destroyed?

> > Thanks for your help,
> > Aaron Long



Tue, 06 Jul 2004 01:11:51 GMT  
 Object Pooling questions
I'm sorry, that was stupid on my part. Of course it means your objects
are not released - nothing to do with FinalRelease. You have to find
out why your objects are not released. May I also suggest posting at
the COM+ group:

microsoft.public.platformsdk.complus_mts

--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD

MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================

Quote:

> Thank you for your help.

> I believe I have the function defined correctly.
> Here is how I have FinalRelease defined.

> [Method Definition]
> void CBroadcast::FinalRelease()
> {
>    ... delete some internal objects.
>    ... write a few log messages.
> }

> [Class Definition]
> // IBroadcast
> public:
>         ...
> HRESULT FinalConstruct();
> void FinalRelease();
>         ...

> Do you see any problems?  Again, FinalRelease will be called when the
> object is not pooled, but it is still running in MTS.  Is there a
> special way to define FinalRelease when you use object pooling?  I am
> assuming that the object is destroyed because I have explicity shut
> down the MTS package, but the resources are not being freed and the
> log files are not being written to as they are when pooling is
> disabled.

> Thanks for your help again.
> Aaron


> > FinalRelease is called in the destructor of CComObject<>. That is
> > called from "delete this" in the implementation of Release in the
> > same class. If your FinalRelease is not called, but the object is
> > indeed destroyed, that means exactly one thing - the signature of
> > your FinalRelease method is incorrect. Release calls the default
> > FinalRelease which does nothing.

> > --
> > =========================
> > ============
> > Alexander Nickolov
> > Microsoft MVP [VC], MCSD

> > MVP VC FAQ: http://www.mvps.org/vcfaq
> > =========================
> > ============



> > > I know that FinalRelease() is not called after a method call on a
> > > pooled object, it keeps the object in memory for later use.  However,
> > > shouldn't it be called when MTS destroys the object?  So if the object
> > > is destroyed because the application is shutdown either by idle or
> > > manual means shouldn't MTS call FinalRelease() at that point?

> > > I have an ATL COM object that is not calling FinalRelease() ever so
> > > when the application shuts down due to the application being idle the
> > > resources are not being released.  If FinalRelease() is never called
> > > when objects are pooled than how do you release resources when the
> > > object is destroyed?

> > > Thanks for your help,
> > > Aaron Long



Tue, 06 Jul 2004 04:50:29 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. More questions on Object Pooling

2. LOOKING FOR: ATL Com+ C++ Object Pooled Connection Object (PAID JOB)

3. disposing of all objects in object pool

4. OleDB Resource pooling Vs. ODBC Connection pooling

5. Object pooling without using COM+

6. Object pooling and Aggregation

7. how does win9x support Object pooling?

8. FinalRelease not being called when object is pooled.

9. Using C++ pooled object from VB

10. Help: Connection / Object Pooling

11. RtlSizeHeap and object pooling strange behavior !!

12. Need tutorial to create object that can be pooled in Com+

 

 
Powered by phpBB® Forum Software