B2022-025: Barakah print/merge of alarm gets out of memory error – dispose procs loaded in when resolving transition text
Added a null check Added some aids for debugging the contentinfo cache
This commit is contained in:
@@ -3824,7 +3824,7 @@ namespace VEPROMS.CSLA.Library
|
||||
try
|
||||
{
|
||||
ReadData(dr);
|
||||
AddContent(dr);
|
||||
//AddContent(dr); // B2022-025: memory leak. Content gets added in other places - this was adding it twice.
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -6936,6 +6936,38 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// B2022-025: memory crash. Dispose was added to the TransitionLookup class to dispose of contents and items loaded in when
|
||||
// resolving transition link text for procedures other than the current one being printed. The transition lookup code
|
||||
// creates objects for a procedure if a transition points (external trans) to it and never disposes of these objects. For
|
||||
// Barakah merged prints with alot of procedures to merge and when the procedures have external transitions, the program
|
||||
// would crash with out of memory. Do not dispose of objects for the current procedure (int procID parameter) - this caused
|
||||
// a crash.
|
||||
public void Dispose(int procID)
|
||||
{
|
||||
foreach (Dictionary<int, ItemInfo> mylookup in MyLookups.Values)
|
||||
{
|
||||
if (mylookup != null)
|
||||
{
|
||||
foreach (ItemInfo ii in mylookup.Values)
|
||||
{
|
||||
if (ii.MyProcedure.ItemID != procID)
|
||||
{
|
||||
if (ii.MyContent.ContentParts != null)
|
||||
{
|
||||
foreach (PartInfo pi in ii.MyContent.ContentParts) pi.Dispose();
|
||||
ii.MyContent.ContentParts.Dispose();
|
||||
}
|
||||
if (ii.MyContent.MyGrid != null) ii.MyContent.MyGrid.Dispose();
|
||||
ii.MyContent.Dispose();
|
||||
ii.Dispose();
|
||||
}
|
||||
}
|
||||
mylookup.Clear();
|
||||
}
|
||||
}
|
||||
MyLookups.Clear();
|
||||
MyLookups = null;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region ProcedureInfo
|
||||
@@ -7149,6 +7181,10 @@ namespace VEPROMS.CSLA.Library
|
||||
tmp.FromType = E_FromType.Procedure;
|
||||
SetFromType(tmp);
|
||||
SetParentSectionAndDocVersion(tmp, tmp.MyDocVersion, null, tmp.MyDocVersion, tranLookup);
|
||||
// B2022-025: dispose cached items after setting transition text that gets done in SetParentSectionAndDocVersion & collect related garbage
|
||||
tranLookup.Dispose(tmp.ItemID);
|
||||
tranLookup = null;
|
||||
GC.Collect();
|
||||
//TimeSpan ts = DateTime.Now.Subtract(dt);
|
||||
//ticksItems = ts.Ticks - (ticksROUsage + ticksTrans);
|
||||
//ItemInfo.ShowTicks();
|
||||
|
Reference in New Issue
Block a user