Quality Center / ALM User Discussions
cancel

using OTAClient.dll in C#

Highlighted
Stefam
Absent Member.

using OTAClient.dll in C#

Hello,

I'm developing a WebService in C# with OTAClient Library.
Don't have any problems with the Objects, etc but with memory.
How do I release these COM Objects in a correct way.
FinalReleaseComObject, doesn't seem to do the trick.
Here is a little example:

 

TestSetFolderWr ret = new TestSetFolderWr(tsf.Path);      

List childrenOr = tsf.NewList();
List<TestSetFolderWr> children = new List<TestSetFolderWr>();

foreach (var item in childrenOr)
{
   children.Add(getTestSetFolderWrFromOr((TestSetFolder)item));
   Marshal.FinalReleaseObject(item);
}
ret.children = children.ToArray();
Marshal.FinalReleaseObject(childrenOr);
return ret;

 That's a part where memory increases most, not even at getting the root folder itself by

TestSetTreeManager lManager = (TestSetTreeManager)tdc.TestSetTreeManager;
TestSetFolder root = (TestSetFolder)lManager.Root;
Marshal.FinalReleaseComObject(lManager);

 The more objects I get (here the whole tree of TestSetFolders) the more memory is used and not released.

With little requests like getting Customization Properties it's less.

 

Leak should be caused by the library cause .Net Heap stays stable, while PrivateBytes of Server increase.

 

I can give some more information if you need, though i didn't went to deep in debugging yet.

 

Have a nice christmas time.

Stefan

2 REPLIES
Stefam
Absent Member.

Re: using OTAClient.dll in C#

Another question on how I may find an answer myself.
How do I debug the dll? Is there a way to analyze the unmanaged memory?

AscertRobw
Absent Member.

Re: using OTAClient.dll in C#

Not to dishearten you, but we also experience leaks in OTA.

 

We rigorously went through our code and made sure we were freeing every object, and releasing all COM references. We had missed a few, so usage went down.

 

But we've got to a point where we can't get any further leaks down - and are 95% sure that there are some inherent leaks in the OTAClient.dll. If you search these forums, and the web, you'll find postings where other folks came to the same conclusion.

 

Our plugin is C++, and we used a range of the standard and free memory usage analyzers - including those in Visual Studio. They all helped to a degree. We also trialeld a few of the commercial ones. Our experience was that they didn't shed any more light than the free ones, but YMMV

 

- Rob