From: Brendan M. <bre...@pr...> - 2009-08-07 13:44:46
|
Ack! Apparently the act of stepping through the C# code impacts the outcome. Removing the breakpoint on run.chromatogramList causes everything to behave as expected. So, it really was just the missing ChromatogramList.Dispose() call all along... and unfortunately, I am 2 hours of debugging past realizing that. Also apparently that Dispose() method can be triggered with a using () block, despite not implementing IDisposable... Oh, well, at least it works now, and I certainly have a much better understanding of the inner workings of the MSData.Run. :-) --Brendan On Fri, Aug 7, 2009 at 6:07 AM, Brendan MacLean <bre...@pr...>wrote: > Hi Matt, > My kingdom for a data breakpoint! Apparently you can't set them in C# > debugging, even with native debugging enabled. > > But, I have gotten a bit further. All the interesting add_ref calls seem > to happen executing the line of C# code: > > run.chromatogramList > > I can watch the ref count in the memory window, and it gets incremented 3 > times: > > - Before the actual C++ code for Run::chromatogramList::get() > - As expected in the code for Run::chromatogramList::get(), and I can > break on the add_ref_copy() call that does it. > - After the debugger has returned to the C# code, during the step to > the next line > > My code appears to add no further references to the chromatogramList, and > when I Dispose() it, the count drops to 2. And, when the CLI > ChromatogramList object is actually destroyed in garbage collection, the > destructor for the C++ ChromatogramList fires. > > Sure wish I could figure out where to put the breakpoint in > shared_count.hpp to catch the two bounding add_ref calls. And, of course, a > data breakpoint would make this so much easier. > > Anyway, moving forward still.... > > --Brendan > > > On Fri, Aug 7, 2009 at 5:50 AM, Matt Chambers < > mat...@va...> wrote: > >> It might be some ChromatogramIdentity objects that haven't been >> disposed. Those hold references to their parent list because in the >> native code they are destroyed when the list is destroyed. >> >> We discussed having an explicit close function for MSData but it hasn't >> been done yet. The distasteful thing is that the function would have no >> meaning for the base MSData class, only for MSDataFile. And what do you >> do with MSData objects from WIFF files which share their WiffFilePtr >> with other MSData objects from the same WIFF? >> >> Also, have you tried a using(MSData blah bla) {} block? >> >> -Matt >> >> >> Brendan MacLean wrote: >> > Well, the root cause appears to be the CLI binding for >> > ChromatogramList is holding onto the ChromatogramList_mzML, which in >> > turn has a shared_pointer on the file. I thought I was home free when >> > I noticed that both ChromatogramList and SpectrumList have Dispose() >> > methods (though not implementing IDisposable). But, I have tried >> > calling ChromatogramList.Dispose() to no avail, and stepping into it, >> > it does release a shared pointer, but the reference count appears to >> > be 3 before the release and 2 after. The C++ version of >> > ChromatogramList doesn't have its destructor called until the GC >> > thread gets a turn at the end of my test. Though the C++ MSData and >> > SpectrumList (which I am not using) get destroyed when I call >> > MSData.Dispose(). >> > >> > Quite a tangled web, but PWiz really does need to support >> > deterministic file closing from the CLI binding... >> > >> > --Brendan >> > >> > On Thu, Aug 6, 2009 at 4:24 PM, Brendan MacLean >> > <bre...@pr... <mailto:bre...@pr...>> wrote: >> > >> > I had been assuming MSData.Dispose() would close any open file >> > handles, but as I am writing regression tests, it appears that I >> > was mistaken. And on a simple mzML file no less. I'll dig into >> > this further, but if anyone would like to offer a solution, I'd be >> > happy to hear of it... >> > >> > --Brendan >> > >> > >> >> >> >> ------------------------------------------------------------------------------ >> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 >> 30-Day >> trial. Simplify your report design, integration and deployment - and focus >> on >> what you do best, core application coding. Discover what's new with >> Crystal Reports now. http://p.sf.net/sfu/bobj-july >> _______________________________________________ >> proteowizard-developer mailing list >> pro...@li... >> https://lists.sourceforge.net/lists/listinfo/proteowizard-developer >> > > |