keeping XSystem open & emptying factoryObjects collection

May 18, 2010 at 4:02 AM

Hi,

My intent is to keep an XSystem instance open for the lifetime of a windows service, without having to create & authenticate xsystem's per request (as this costs around 220ms per request).

This raises a problem, as the XSystem maintains a collection of XSet objects within the factoryObjects collection and this continues to grow and grow...

What would you recommend?

- Stop doing it that way and recreate every request? (please no!)

- Amend XSystem to provide a method to remove XSet from factoryObjects?

Any other suggestions?

 

Regards

Steve

Coordinator
May 18, 2010 at 9:57 AM
Steve - the XSet objects get removed when they are disposed, so once you no longer need them you can remove them from the collection by explicitly calling dispose.

Regards, Graham L. Stuart
Centera SDK Architect


From: SteveC <notifications@codeplex.com>
To: Stuart, Graham
Sent: Mon May 17 23:02:59 2010
Subject: keeping XSystem open & emptying factoryObjects collection [xamsdk:212960]

From: SteveC

Hi,

My intent is to keep an XSystem instance open for the lifetime of a windows service, without having to create & authenticate xsystem's per request (as this costs around 220ms per request).

This raises a problem, as the XSystem maintains a collection of XSet objects within the factoryObjects collection and this continues to grow and grow...

What would you recommend?

- Stop doing it that way and recreate every request? (please no!)

- Amend XSystem to provide a method to remove XSet from factoryObjects?

Any other suggestions?

Regards

Steve

May 19, 2010 at 1:56 AM

Hi Graham,

I have the xset objects disposed implicitly through a 'using' statement.

I am experiencing the same memory leak when I use the XAMSDK test harness.

If you run option 12 multiple times and then add the following watch (using Visual Studio):  ((XAMSDK.XAMObject)(xsys)).factoryObjects

This contains a collection of XSet objects (each with property of disposed=true). Shouldn't the collection be 0?

Regards,

Steve.

Coordinator
May 19, 2010 at 2:14 AM
Yes, it should be zero! Have you tried setting a breakpoint on the dispose method and tacking to see why the "remove from collection" code is not being called?

I am swamped with other stuff just now so don't have the bandwidth to look into this just now I'm afraid.

I presume you are using the latest drop?

Regards, Graham L. Stuart
Centera SDK Architect


From: SteveC <notifications@codeplex.com>
To: Stuart, Graham
Sent: Tue May 18 20:56:59 2010
Subject: Re: keeping XSystem open & emptying factoryObjects collection [xamsdk:212960]

From: SteveC

Hi Graham,

I have the xset objects disposed implicitly through a 'using' statement.

I am experiencing the same memory leak when I use the XAMSDK test harness.

If you run option 12 multiple times and then add the following watch (using Visual Studio): ((XAMSDK.XAMObject)(xsys)).factoryObjects

This contains a collection of XSet objects (each with property of disposed=true). Shouldn't the collection be 0?

Regards,

Steve.

May 19, 2010 at 4:42 AM

Hi Graham,

Rather than remove XSet's from the XSystem collection, I dont see any reason to add them in the first place. They are also tracked within the XSet static collection.

I have created work item 8396 and will shortly upload a patch for you to review.

Thanks.

Coordinator
May 19, 2010 at 11:33 AM
Edited May 20, 2010 at 6:51 AM

Steve – there is a good reason for tracking them within the XSystem. You cannot close an XSystem that has underlying XSet objects open. By tracking them in the XSystem, we are able to “force close” any open XSets and thus prevent an error if the application attempts to close the XSystem.

There is a bug, but the bug is that when an XSet is closed, it should be removed from the XSystem factory objects list. I have addressed this and will upload a fix shortly.