473,396 Members | 1,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

COM+ pool object in C# is not return to the pool

Hi All:

I am creating a COM+ Pool object in C#. I set up the following attributes:
JIT (true),Pool size; and at the end of each public method I called
ContextUtil.DeactivateOnReturn=true to set DONE flag; and also I override
CanBeBooled method to true.

In my calling program in C#, first of all I am using NEW to create a object,
then I call the method then I call dispose.

No matter how I try I do not see the object has been released back to pool.
Does anyone have similar problem ?

Thanks in advance
Nov 17 '05 #1
5 2991
You should attach the AutoComplete attribute to every method that you
expose. This is needed to release the object back to the pool.

Also, don't call Dispose on your object. This has the effect of pulling
an object from the pool, activating it, and then releasing it back to the
pool. It's a wasted call.

If you use the AutoComplete attribute, you don't need to set the
DeactivateOnReturn property.

If you want to have dispose semantics on a JIT activated object, then
you need to override the Activate and Deactivate methods on your component
based on ServicedComponent.

Additionally, if the component is not JIT activated, then you would need
to call Dispose to release it back to the pool. When it is JIT activated,
then the object is pulled from the pool and activated before every call.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"da*******@opco.com" <da*************@discussions.microsoft.com> wrote in
message news:5B**********************************@microsof t.com...
Hi All:

I am creating a COM+ Pool object in C#. I set up the following attributes:
JIT (true),Pool size; and at the end of each public method I called
ContextUtil.DeactivateOnReturn=true to set DONE flag; and also I override
CanBeBooled method to true.

In my calling program in C#, first of all I am using NEW to create a
object,
then I call the method then I call dispose.

No matter how I try I do not see the object has been released back to
pool.
Does anyone have similar problem ?

Thanks in advance

Nov 17 '05 #2
I tried AutoComplete attribute and comment out DeactivateOnReturn code in my
public method.

In additon, since COM+ pool object is JIT. I override Activate and Deactive
method with code like base.Activate and base.Deactive.

Here is calling routine:
.....
using (CommandCenter myPool = new CommandCenter())
{
sRet = myPool.GetSybaseODBCConnection
("insightdb","nyns0608");
}
.....
and I still do not see object is return to the pool.
"Nicholas Paldino [.NET/C# MVP]" wrote:
You should attach the AutoComplete attribute to every method that you
expose. This is needed to release the object back to the pool.

Also, don't call Dispose on your object. This has the effect of pulling
an object from the pool, activating it, and then releasing it back to the
pool. It's a wasted call.

If you use the AutoComplete attribute, you don't need to set the
DeactivateOnReturn property.

If you want to have dispose semantics on a JIT activated object, then
you need to override the Activate and Deactivate methods on your component
based on ServicedComponent.

Additionally, if the component is not JIT activated, then you would need
to call Dispose to release it back to the pool. When it is JIT activated,
then the object is pulled from the pool and activated before every call.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"da*******@opco.com" <da*************@discussions.microsoft.com> wrote in
message news:5B**********************************@microsof t.com...
Hi All:

I am creating a COM+ Pool object in C#. I set up the following attributes:
JIT (true),Pool size; and at the end of each public method I called
ContextUtil.DeactivateOnReturn=true to set DONE flag; and also I override
CanBeBooled method to true.

In my calling program in C#, first of all I am using NEW to create a
object,
then I call the method then I call dispose.

No matter how I try I do not see the object has been released back to
pool.
Does anyone have similar problem ?

Thanks in advance


Nov 17 '05 #3
How are you making the determination that the object is getting returned
to the pool?

Also, is CommandCenter your serviced component? If so, you should NOT
be using it in a using statement, and you should NOT call dispose on it
(since it is JIT activated and pooled).

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"da*******@opco.com" <da*************@discussions.microsoft.com> wrote in
message news:12**********************************@microsof t.com...
I tried AutoComplete attribute and comment out DeactivateOnReturn code in
my
public method.

In additon, since COM+ pool object is JIT. I override Activate and
Deactive
method with code like base.Activate and base.Deactive.

Here is calling routine:
....
using (CommandCenter myPool = new CommandCenter())
{
sRet = myPool.GetSybaseODBCConnection
("insightdb","nyns0608");
}
....
and I still do not see object is return to the pool.
"Nicholas Paldino [.NET/C# MVP]" wrote:
You should attach the AutoComplete attribute to every method that you
expose. This is needed to release the object back to the pool.

Also, don't call Dispose on your object. This has the effect of
pulling
an object from the pool, activating it, and then releasing it back to the
pool. It's a wasted call.

If you use the AutoComplete attribute, you don't need to set the
DeactivateOnReturn property.

If you want to have dispose semantics on a JIT activated object, then
you need to override the Activate and Deactivate methods on your
component
based on ServicedComponent.

Additionally, if the component is not JIT activated, then you would
need
to call Dispose to release it back to the pool. When it is JIT
activated,
then the object is pulled from the pool and activated before every call.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"da*******@opco.com" <da*************@discussions.microsoft.com> wrote in
message news:5B**********************************@microsof t.com...
> Hi All:
>
> I am creating a COM+ Pool object in C#. I set up the following
> attributes:
> JIT (true),Pool size; and at the end of each public method I called
> ContextUtil.DeactivateOnReturn=true to set DONE flag; and also I
> override
> CanBeBooled method to true.
>
> In my calling program in C#, first of all I am using NEW to create a
> object,
> then I call the method then I call dispose.
>
> No matter how I try I do not see the object has been released back to
> pool.
> Does anyone have similar problem ?
>
> Thanks in advance
>
>


Nov 17 '05 #4
two ways: one way is looking at memory useage DllHost is keeping getting
bigger after each client call. The other way is looking at status view on
COM+ managers. There is nothing under Pooled column.

Yes, my commandcenter is serviced component. I was reading somewhere
recommended to use Dispose no matter what.

"Nicholas Paldino [.NET/C# MVP]" wrote:
How are you making the determination that the object is getting returned
to the pool?

Also, is CommandCenter your serviced component? If so, you should NOT
be using it in a using statement, and you should NOT call dispose on it
(since it is JIT activated and pooled).

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"da*******@opco.com" <da*************@discussions.microsoft.com> wrote in
message news:12**********************************@microsof t.com...
I tried AutoComplete attribute and comment out DeactivateOnReturn code in
my
public method.

In additon, since COM+ pool object is JIT. I override Activate and
Deactive
method with code like base.Activate and base.Deactive.

Here is calling routine:
....
using (CommandCenter myPool = new CommandCenter())
{
sRet = myPool.GetSybaseODBCConnection
("insightdb","nyns0608");
}
....
and I still do not see object is return to the pool.
"Nicholas Paldino [.NET/C# MVP]" wrote:
You should attach the AutoComplete attribute to every method that you
expose. This is needed to release the object back to the pool.

Also, don't call Dispose on your object. This has the effect of
pulling
an object from the pool, activating it, and then releasing it back to the
pool. It's a wasted call.

If you use the AutoComplete attribute, you don't need to set the
DeactivateOnReturn property.

If you want to have dispose semantics on a JIT activated object, then
you need to override the Activate and Deactivate methods on your
component
based on ServicedComponent.

Additionally, if the component is not JIT activated, then you would
need
to call Dispose to release it back to the pool. When it is JIT
activated,
then the object is pulled from the pool and activated before every call.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"da*******@opco.com" <da*************@discussions.microsoft.com> wrote in
message news:5B**********************************@microsof t.com...
> Hi All:
>
> I am creating a COM+ Pool object in C#. I set up the following
> attributes:
> JIT (true),Pool size; and at the end of each public method I called
> ContextUtil.DeactivateOnReturn=true to set DONE flag; and also I
> override
> CanBeBooled method to true.
>
> In my calling program in C#, first of all I am using NEW to create a
> object,
> then I call the method then I call dispose.
>
> No matter how I try I do not see the object has been released back to
> pool.
> Does anyone have similar problem ?
>
> Thanks in advance
>
>


Nov 17 '05 #5
In this case, no, you can not call Dispose. If you do, you are pulling
a new object from the pool, and then it is being activated (because of JIT),
and then you are calling Dispose, and deactivating the object. It's a waste
of a call.

You aren't saving state across calls to this object, are you? It is
EXTREMELY important that you do not persist state in your objects when you
pool them like this (at least, state that is modified as the result of
calls, state that is created at object construction time which is the same
across all pooled instances is ok).

Also, looking at the memory usage for DllHost isn't going to tell you
anything, since that is just .NET doing what .NET does (to put it simply)
when it comes to memory management and the like. Also, how can you be sure
which DllHost process is yours?

In the Pooled column in the status view, it tells you how many objects
are currently in the pool. It doesn't tell you if objects are not released.

I think your objects really are being pooled correctly, you just think
they arent.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"da*******@opco.com" <da*************@discussions.microsoft.com> wrote in
message news:E6**********************************@microsof t.com...
two ways: one way is looking at memory useage DllHost is keeping getting
bigger after each client call. The other way is looking at status view on
COM+ managers. There is nothing under Pooled column.

Yes, my commandcenter is serviced component. I was reading somewhere
recommended to use Dispose no matter what.

"Nicholas Paldino [.NET/C# MVP]" wrote:
How are you making the determination that the object is getting
returned
to the pool?

Also, is CommandCenter your serviced component? If so, you should
NOT
be using it in a using statement, and you should NOT call dispose on it
(since it is JIT activated and pooled).

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"da*******@opco.com" <da*************@discussions.microsoft.com> wrote in
message news:12**********************************@microsof t.com...
>I tried AutoComplete attribute and comment out DeactivateOnReturn code
>in
>my
> public method.
>
> In additon, since COM+ pool object is JIT. I override Activate and
> Deactive
> method with code like base.Activate and base.Deactive.
>
> Here is calling routine:
> ....
> using (CommandCenter myPool = new CommandCenter())
> {
> sRet = myPool.GetSybaseODBCConnection
> ("insightdb","nyns0608");
> }
> ....
> and I still do not see object is return to the pool.
>
>
> "Nicholas Paldino [.NET/C# MVP]" wrote:
>
>> You should attach the AutoComplete attribute to every method that
>> you
>> expose. This is needed to release the object back to the pool.
>>
>> Also, don't call Dispose on your object. This has the effect of
>> pulling
>> an object from the pool, activating it, and then releasing it back to
>> the
>> pool. It's a wasted call.
>>
>> If you use the AutoComplete attribute, you don't need to set the
>> DeactivateOnReturn property.
>>
>> If you want to have dispose semantics on a JIT activated object,
>> then
>> you need to override the Activate and Deactivate methods on your
>> component
>> based on ServicedComponent.
>>
>> Additionally, if the component is not JIT activated, then you
>> would
>> need
>> to call Dispose to release it back to the pool. When it is JIT
>> activated,
>> then the object is pulled from the pool and activated before every
>> call.
>>
>> Hope this helps.
>>
>>
>> --
>> - Nicholas Paldino [.NET/C# MVP]
>> - mv*@spam.guard.caspershouse.com
>>
>> "da*******@opco.com" <da*************@discussions.microsoft.com> wrote
>> in
>> message news:5B**********************************@microsof t.com...
>> > Hi All:
>> >
>> > I am creating a COM+ Pool object in C#. I set up the following
>> > attributes:
>> > JIT (true),Pool size; and at the end of each public method I called
>> > ContextUtil.DeactivateOnReturn=true to set DONE flag; and also I
>> > override
>> > CanBeBooled method to true.
>> >
>> > In my calling program in C#, first of all I am using NEW to create a
>> > object,
>> > then I call the method then I call dispose.
>> >
>> > No matter how I try I do not see the object has been released back
>> > to
>> > pool.
>> > Does anyone have similar problem ?
>> >
>> > Thanks in advance
>> >
>> >
>>
>>
>>


Nov 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: VinDotNet | last post by:
Here's the Scenario I am facing: I've got a winform managed c++ client which connects to my managed COM+ server application (by making createinstance, then typecasting the object to an interface,...
0
by: TheRipper | last post by:
Hi All, I am in the process of writing a VB.NET COM+ wrapper for a C dll that I have been given from a B2B partner. The dll will be put in an object pool so that connections can stay alive...
1
by: Lee Greco | last post by:
I'm looking for some advice on how to proceed. Here's the scenario: I've got to develop a high availability VB.Net web service that basically acts as a middle man between the web service...
5
by: Greg | last post by:
A COM object is in a thread as a running binary that is available to be used by it's clients. ..NET Assemblies refer to DLLs that have MSIL not binary code. Do .NET obects run in their own...
5
by: mackenzie | last post by:
Hello, I am looking for a little bit of help. I am trying to create a dynamically allocated object which contains one or more objects of type boost::pool<>. I get a compiler error when an object...
11
by: Grey Alien | last post by:
Any one know of an open source memory pool library?. I can't seem to find any implemented in C (many available in C++ e.g. Boost). Google is not turning up anything useful ...
1
by: =?Utf-8?B?VmVua2F0ZXNhbiBT?= | last post by:
Hi, I have a requirement of consuming a connection object returned from a COM component deployed in COM+ application. I have given the need for this requirement end of my query. My component...
1
by: Joseph Geretz | last post by:
If an HttpHandler is implementing IsReusable = true, is the instance notitifed when it is actually released to the pool? Of course, each instance is released to the pool when ProcessRequest...
5
by: =?Utf-8?B?VHJlY2l1cw==?= | last post by:
Hello, Newsgroupians: I have a method that requires me to specify a client handle when I create the object. The object prototype is as follows... void Server.CreateMonitor(string strName, int...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.