From 136a0235647e2bdbf90a30facdc13cd6e7aa99ad Mon Sep 17 00:00:00 2001 From: Kathy Date: Mon, 11 Jun 2012 16:20:03 +0000 Subject: [PATCH] --- PROMS/DataLoader/DocVersions.cs | 2 ++ PROMS/DataLoader/Documents.cs | 20 +++++++++++--------- PROMS/DataLoader/RoFst.cs | 1 + 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/PROMS/DataLoader/DocVersions.cs b/PROMS/DataLoader/DocVersions.cs index d102f510..b19d1441 100644 --- a/PROMS/DataLoader/DocVersions.cs +++ b/PROMS/DataLoader/DocVersions.cs @@ -45,8 +45,10 @@ namespace DataLoader // The INF files contain a path to a corresponding NDX file - had data with bat NDX path DeleteINFFiles(pth); _OutTran = new OutsideTransition(cn); + frmMain.AddInfo("Before MigrateROFST{0}\r\n{1}", GC.GetTotalMemory(true), VEPROMS.CSLA.Library.CSLACache.UsageAll); MigrateROFST(pth, docver); GC.Collect(); + frmMain.AddInfo("After MigrateROFST{0}\r\n{1}", GC.GetTotalMemory(true), VEPROMS.CSLA.Library.CSLACache.UsageAll); // Migrate library documents MigrateLibDocs(cn, pth); // Initialize Dictionaries diff --git a/PROMS/DataLoader/Documents.cs b/PROMS/DataLoader/Documents.cs index fa166e9e..d735f9e0 100644 --- a/PROMS/DataLoader/Documents.cs +++ b/PROMS/DataLoader/Documents.cs @@ -287,15 +287,17 @@ namespace DataLoader int nBytesRead = fs.Read(ByteArray, 0, (int)len); fs.Close(); string t1 = (title == null || title == "") ? null : title; - Document doc = Document.MakeDocument(t1, ByteArray, null, ci == null ? null : ci.ToString(), dtsutc, "Migration", ".Doc"); - FileInfo tmpFile = new FileInfo(temppath); - string docfile = temppath.Substring(0, temppath.LastIndexOf(".")) + @".doc"; - if (File.Exists(docfile)) File.Delete(docfile); - FileInfo doctmpFile = tmpFile.CopyTo(docfile); - doc.DocAscii = ascii; - doc.Save(); - File.Delete(docfile); - return doc.DocID; + using (Document doc = Document.MakeDocument(t1, ByteArray, null, ci == null ? null : ci.ToString(), dtsutc, "Migration", ".Doc")) + { + FileInfo tmpFile = new FileInfo(temppath); + string docfile = temppath.Substring(0, temppath.LastIndexOf(".")) + @".doc"; + if (File.Exists(docfile)) File.Delete(docfile); + FileInfo doctmpFile = tmpFile.CopyTo(docfile); + doc.DocAscii = ascii; + doc.Save(); + File.Delete(docfile); + return doc.DocID; + } } // for an io exception, keep trying catch (IOException exio) diff --git a/PROMS/DataLoader/RoFst.cs b/PROMS/DataLoader/RoFst.cs index 1aa4e269..5682df15 100644 --- a/PROMS/DataLoader/RoFst.cs +++ b/PROMS/DataLoader/RoFst.cs @@ -174,6 +174,7 @@ namespace DataLoader //figure = Figure.MakeFigure(rofst, roImg, null); using (Figure tfig = Figure.MakeFigure(rofst, roImg, null)) ; } + roImg.Dispose(); } } else