Reduced memory usage
Add Memory Usage summary to the log file. GetJustFormat to reduce memory use Fix code so that children are not disposed while they are being used Added new method GetJustFormat to reduce memory use Fix logic so that content is not used after it is disposed Verify that Content object is not disposed before using Text Dispose of parts when Content object is disposed Verify that ContentInfo object is not disposed before using Text Dispose of parts when ContentInfo object is disposed Place brackets around DB names to support names containing periods. Dispose of parts when Item object is disposed Removed inapproriate Dispose in MakeItem Dispose of parts when ItemInfo object is disposed Remove event handler when ItemInfoList object is disposed Dispose of parts when Transtion object is disposed Dispose of parts when ZTransition object is disposed
This commit is contained in:
@@ -139,7 +139,7 @@ namespace DataLoader
|
|||||||
|
|
||||||
// test for performance
|
// test for performance
|
||||||
Content cont;
|
Content cont;
|
||||||
Format fmt2 = format == null ? null : format.Get();
|
Format fmt2 = format == null ? null : format.GetJustFormat();
|
||||||
cont = Content.New(Number, Title, 10000+docstyleindx, fmt2, ci==null?null:ci.ToString(), Dts, Userid);
|
cont = Content.New(Number, Title, 10000+docstyleindx, fmt2, ci==null?null:ci.ToString(), Dts, Userid);
|
||||||
if (needEntry)
|
if (needEntry)
|
||||||
{
|
{
|
||||||
|
@@ -180,12 +180,15 @@ namespace DataLoader
|
|||||||
}
|
}
|
||||||
if (frType > 0)
|
if (frType > 0)
|
||||||
{
|
{
|
||||||
using (Content c = Content.Get(parentItem.ContentID))
|
//using (Content c = Content.Get(parentItem.ContentID))
|
||||||
{
|
//{
|
||||||
c.ContentParts.Add(frType, item);
|
// c.ContentParts.Add(frType, item);
|
||||||
if (!c.IsSavable) ErrorRpt.ErrorReport(c);
|
// if (!c.IsSavable) ErrorRpt.ErrorReport(c);
|
||||||
c.Save();
|
// c.Save();
|
||||||
}
|
//}
|
||||||
|
parentItem.MyContent.ContentParts.Add(frType, item);
|
||||||
|
if (!parentItem.MyContent.IsSavable) ErrorRpt.ErrorReport(parentItem.MyContent);
|
||||||
|
parentItem.MyContent.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove styles that user entered but are automatically done via the format
|
// Remove styles that user entered but are automatically done via the format
|
||||||
|
@@ -17,7 +17,6 @@ namespace DataLoader
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_MyParent = myParent;
|
_MyParent = myParent;
|
||||||
}
|
}
|
||||||
private List<string> _MyMessages = new List<string>();
|
|
||||||
private int _ErrorCount = 0;
|
private int _ErrorCount = 0;
|
||||||
|
|
||||||
public int ErrorCount
|
public int ErrorCount
|
||||||
@@ -54,7 +53,6 @@ namespace DataLoader
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
_MyMessages.Add(err);
|
|
||||||
tbErrors.SelectionStart = tbErrors.TextLength;
|
tbErrors.SelectionStart = tbErrors.TextLength;
|
||||||
tbErrors.SelectedText = sep + err;
|
tbErrors.SelectedText = sep + err;
|
||||||
sep = "\r\n";
|
sep = "\r\n";
|
||||||
@@ -76,8 +74,7 @@ namespace DataLoader
|
|||||||
public void Save(string path)
|
public void Save(string path)
|
||||||
{
|
{
|
||||||
StreamWriter fs = new StreamWriter(path, false);
|
StreamWriter fs = new StreamWriter(path, false);
|
||||||
foreach (string txt in _MyMessages)
|
fs.Write(tbErrors.Text);
|
||||||
fs.WriteLine(txt);
|
|
||||||
fs.Close();
|
fs.Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -744,6 +744,7 @@ namespace DataLoader
|
|||||||
ProcessComplete = false;
|
ProcessComplete = false;
|
||||||
Clipboard.Clear();
|
Clipboard.Clear();
|
||||||
Clipboard.SetText(mb.ToString());
|
Clipboard.SetText(mb.ToString());
|
||||||
|
AddInfo(mb.ToString());
|
||||||
MessageBox.Show(mb.ToString(), "Processing Complete", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
MessageBox.Show(mb.ToString(), "Processing Complete", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
}
|
}
|
||||||
private void ConvertToChangeManager()
|
private void ConvertToChangeManager()
|
||||||
|
@@ -190,7 +190,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (_Section != null)
|
if (_Section != null)
|
||||||
_Section.MyContent.MyFormat = value == null ? null : value.Get();
|
_Section.MyContent.MyFormat = value == null ? null : value.GetJustFormat();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[Category("Format")]
|
[Category("Format")]
|
||||||
|
@@ -316,6 +316,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
public partial class FormatInfo : IFormatOrFormatInfo
|
public partial class FormatInfo : IFormatOrFormatInfo
|
||||||
{
|
{
|
||||||
|
public virtual Format GetJustFormat()
|
||||||
|
{
|
||||||
|
return _Editable = Format.GetJustFormat(_FormatID);
|
||||||
|
}
|
||||||
public static bool HasLatestChanges()
|
public static bool HasLatestChanges()
|
||||||
{
|
{
|
||||||
if (!HasSeqTabFmtTabToken()) return false;
|
if (!HasSeqTabFmtTabToken()) return false;
|
||||||
|
@@ -423,9 +423,9 @@ namespace VEPROMS.CSLA.Library
|
|||||||
using(TransitionInfoList trans = TransitionInfoList.GetAffected(this.ItemID))
|
using(TransitionInfoList trans = TransitionInfoList.GetAffected(this.ItemID))
|
||||||
{
|
{
|
||||||
#region B2012-071 fix JCB
|
#region B2012-071 fix JCB
|
||||||
Content oldContent = null;
|
|
||||||
foreach (TransitionInfo tran in trans)
|
foreach (TransitionInfo tran in trans)
|
||||||
{
|
{
|
||||||
|
Content oldContent = null;
|
||||||
using (Content content = tran.MyContent.Get())
|
using (Content content = tran.MyContent.Get())
|
||||||
{
|
{
|
||||||
if (oldContent != null && content.ContentID != oldContent.ContentID)
|
if (oldContent != null && content.ContentID != oldContent.ContentID)
|
||||||
@@ -449,8 +449,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
// content.DTS = DateTime.Now;
|
// content.DTS = DateTime.Now;
|
||||||
// content.Save();
|
// content.Save();
|
||||||
//}
|
//}
|
||||||
}
|
|
||||||
}
|
|
||||||
if (oldContent != null)
|
if (oldContent != null)
|
||||||
{
|
{
|
||||||
if (oldContent.IsDirty)
|
if (oldContent.IsDirty)
|
||||||
@@ -464,6 +462,9 @@ namespace VEPROMS.CSLA.Library
|
|||||||
else // Update ContentInfo objects to reflect the change in the transition
|
else // Update ContentInfo objects to reflect the change in the transition
|
||||||
ContentInfo.Refresh(oldContent);
|
ContentInfo.Refresh(oldContent);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion B2012-071 fix JCB
|
#endregion B2012-071 fix JCB
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -209,12 +209,14 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
if (Disposed) throw new Exception("Attempt to access Disposed Object");
|
||||||
CanReadProperty("Text", true);
|
CanReadProperty("Text", true);
|
||||||
return _Text;
|
return _Text;
|
||||||
}
|
}
|
||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
|
if (Disposed) throw new Exception("Attempt to access Disposed Object");
|
||||||
CanWriteProperty("Text", true);
|
CanWriteProperty("Text", true);
|
||||||
if (value == null) value = string.Empty;
|
if (value == null) value = string.Empty;
|
||||||
if (_Text != value)
|
if (_Text != value)
|
||||||
@@ -883,13 +885,49 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (_Disposed) return;
|
if (_Disposed) return;
|
||||||
_CountDisposed++;
|
_CountDisposed++;
|
||||||
_Disposed = true;
|
_Disposed = true;
|
||||||
|
RemoveFromDictionaries();
|
||||||
|
if (_MyZContent != null) // 9.79
|
||||||
|
{
|
||||||
|
_MyZContent.Dispose();
|
||||||
|
_MyZContent = null;
|
||||||
|
}
|
||||||
|
if (_ContentParts != null) // 8.93
|
||||||
|
{
|
||||||
|
foreach (ContentPart cp in _ContentParts)
|
||||||
|
cp.Dispose();
|
||||||
|
_ContentParts = null;
|
||||||
|
}
|
||||||
|
if (_MyEntry != null) // .465
|
||||||
|
{
|
||||||
|
_MyEntry.Dispose();
|
||||||
|
_MyEntry = null;
|
||||||
|
}
|
||||||
if (_MyGrid != null)
|
if (_MyGrid != null)
|
||||||
{
|
{
|
||||||
_MyGrid.Dispose();
|
_MyGrid.Dispose();
|
||||||
_MyGrid = null;
|
_MyGrid = null;
|
||||||
}
|
}
|
||||||
Disposed = true;
|
_Text = null;
|
||||||
RemoveFromDictionaries();
|
//if (_ContentDetails != null)
|
||||||
|
// _ContentDetails = null;
|
||||||
|
//if (_ContentItems != null)
|
||||||
|
//{
|
||||||
|
// _ContentItems = null;
|
||||||
|
// //foreach (ContentItem ci in _ContentItems)
|
||||||
|
// // ci.Dispose();
|
||||||
|
//}
|
||||||
|
//if (_ContentRoUsages != null)
|
||||||
|
//{
|
||||||
|
// //foreach (ContentRoUsage cr in _ContentRoUsages)
|
||||||
|
// // cr.Dispose();
|
||||||
|
// _ContentRoUsages = null;
|
||||||
|
//}
|
||||||
|
//if (_ContentTransitions != null)
|
||||||
|
//{
|
||||||
|
// foreach (ContentTransition ct in _ContentTransitions)
|
||||||
|
// ct.Dispose();
|
||||||
|
// _ContentTransitions = null;
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
private void RemoveFromDictionaries()
|
private void RemoveFromDictionaries()
|
||||||
{
|
{
|
||||||
|
@@ -136,6 +136,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
if (_Disposed) throw new Exception("Cannot access disposed object");
|
||||||
CanReadProperty("Text", true);
|
CanReadProperty("Text", true);
|
||||||
return _Text;
|
return _Text;
|
||||||
}
|
}
|
||||||
@@ -573,6 +574,25 @@ namespace VEPROMS.CSLA.Library
|
|||||||
while (listContentInfo.Contains(this)) listContentInfo.Remove(this); // Remove the item from the list
|
while (listContentInfo.Contains(this)) listContentInfo.Remove(this); // Remove the item from the list
|
||||||
if (listContentInfo.Count == 0) // If there are no items left in the list
|
if (listContentInfo.Count == 0) // If there are no items left in the list
|
||||||
_CacheByPrimaryKey.Remove(ContentID.ToString()); // remove the list
|
_CacheByPrimaryKey.Remove(ContentID.ToString()); // remove the list
|
||||||
|
if (_Editable != null)
|
||||||
|
_Editable = null;
|
||||||
|
if (_ContentItems != null)
|
||||||
|
_ContentItems = null;
|
||||||
|
_Text = null;
|
||||||
|
//if (_ContentParts != null)
|
||||||
|
// _ContentParts = null;
|
||||||
|
//if (_ContentRoUsages != null)
|
||||||
|
// _ContentRoUsages = null;
|
||||||
|
//if (_ContentTransitions != null)
|
||||||
|
// _ContentTransitions = null;
|
||||||
|
//if (_MyEntry != null)
|
||||||
|
// _MyEntry = null;
|
||||||
|
//if (_MyGrid != null)
|
||||||
|
// _MyGrid = null;
|
||||||
|
//if (_MyImage != null)
|
||||||
|
// _MyImage = null;
|
||||||
|
//if (_MyZContent != null)
|
||||||
|
// _MyZContent = null;
|
||||||
}
|
}
|
||||||
public virtual Content Get()
|
public virtual Content Get()
|
||||||
{
|
{
|
||||||
|
@@ -131,7 +131,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
SqlConnection cn = new SqlConnection(tmp);
|
SqlConnection cn = new SqlConnection(tmp);
|
||||||
cn.Open();
|
cn.Open();
|
||||||
// SqlDataAdapter da = new SqlDataAdapter("select name from sysdatabases where name like 'VEP%' order by name", cn);
|
// SqlDataAdapter da = new SqlDataAdapter("select name from sysdatabases where name like 'VEP%' order by name", cn);
|
||||||
SqlDataAdapter da = new SqlDataAdapter("select name, case when object_id(name + '..Items') is null then 'Not PROMS' when object_id(name + '..Revisions') is not null then 'Approval' when object_id(name + '..ContentAudits') is not null then 'Change Manager' else 'Original' end functionality from sysdatabases where name not in ('master','model','msdb','tempdb') order by name", cn);
|
SqlDataAdapter da = new SqlDataAdapter("select name, case when object_id('[' + name + ']..Items') is null then 'Not PROMS' when object_id('[' + name + ']..Revisions') is not null then 'Approval' when object_id('[' + name + ']..ContentAudits') is not null then 'Change Manager' else 'Original' end functionality from sysdatabases where name not in ('master','model','msdb','tempdb') order by name", cn);
|
||||||
DataSet ds = new DataSet();
|
DataSet ds = new DataSet();
|
||||||
da.Fill(ds);
|
da.Fill(ds);
|
||||||
cn.Close();
|
cn.Close();
|
||||||
|
@@ -734,12 +734,26 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (_Disposed) return;
|
if (_Disposed) return;
|
||||||
_CountDisposed++;
|
_CountDisposed++;
|
||||||
_Disposed = true;
|
_Disposed = true;
|
||||||
|
RemoveFromDictionaries();
|
||||||
if (_MyContent != null)
|
if (_MyContent != null)
|
||||||
{
|
{
|
||||||
_MyContent.Dispose();
|
_MyContent.Dispose();
|
||||||
_MyContent = null;
|
_MyContent = null;
|
||||||
}
|
}
|
||||||
RemoveFromDictionaries();
|
if (_ItemTransitions_RangeID != null)
|
||||||
|
_ItemTransitions_RangeID = null;
|
||||||
|
if (_ItemTransitions_ToID != null)
|
||||||
|
_ItemTransitions_ToID = null;
|
||||||
|
//if (_MyPrevious != null)
|
||||||
|
// _MyPrevious = null;
|
||||||
|
//if (_NextItems != null)
|
||||||
|
// _NextItems = null;
|
||||||
|
//if (_ItemAnnotations != null)
|
||||||
|
// _ItemAnnotations.Dispose();
|
||||||
|
//if (_ItemDocVersions != null)
|
||||||
|
// _ItemDocVersions = null;
|
||||||
|
//if (_ItemParts != null)
|
||||||
|
// _ItemParts = null;
|
||||||
}
|
}
|
||||||
private void RemoveFromDictionaries()
|
private void RemoveFromDictionaries()
|
||||||
{
|
{
|
||||||
@@ -787,7 +801,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
Item tmp2 = tmp;
|
Item tmp2 = tmp;
|
||||||
tmp = tmp2.Save();
|
tmp = tmp2.Save();
|
||||||
tmp2.Dispose();
|
//tmp2.Dispose();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@@ -450,6 +450,20 @@ namespace VEPROMS.CSLA.Library
|
|||||||
while (listItemInfo.Contains(this)) listItemInfo.Remove(this); // Remove the item from the list
|
while (listItemInfo.Contains(this)) listItemInfo.Remove(this); // Remove the item from the list
|
||||||
if (listItemInfo.Count == 0) // If there are no items left in the list
|
if (listItemInfo.Count == 0) // If there are no items left in the list
|
||||||
_CacheByPrimaryKey.Remove(ItemID.ToString()); // remove the list
|
_CacheByPrimaryKey.Remove(ItemID.ToString()); // remove the list
|
||||||
|
if (_MyContent != null)
|
||||||
|
_MyContent = null;
|
||||||
|
if (_MyPrevious != null)
|
||||||
|
_MyPrevious = null;
|
||||||
|
//if (_ActiveFormat != null)
|
||||||
|
// _ActiveFormat = null;
|
||||||
|
//if (_ActiveParent != null)
|
||||||
|
// _ActiveParent = null;
|
||||||
|
//if (_ActiveSection != null)
|
||||||
|
// _ActiveSection = null;
|
||||||
|
//if (_MyDocVersion != null)
|
||||||
|
// _MyDocVersion = null;
|
||||||
|
//if (_ParentNoteOrCaution != null)
|
||||||
|
// _ParentNoteOrCaution = null;
|
||||||
}
|
}
|
||||||
public virtual Item Get()
|
public virtual Item Get()
|
||||||
{
|
{
|
||||||
|
@@ -92,6 +92,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
foreach (ItemInfo tmp in this)
|
foreach (ItemInfo tmp in this)
|
||||||
{
|
{
|
||||||
tmp.Changed -= new ItemInfoEvent(tmp_Changed);
|
tmp.Changed -= new ItemInfoEvent(tmp_Changed);
|
||||||
|
tmp.Deleted -= new ItemInfoEvent(tmp_Deleted);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
@@ -594,6 +594,19 @@ namespace VEPROMS.CSLA.Library
|
|||||||
_CountDisposed++;
|
_CountDisposed++;
|
||||||
_Disposed = true;
|
_Disposed = true;
|
||||||
RemoveFromDictionaries();
|
RemoveFromDictionaries();
|
||||||
|
if (_MyZTransition != null)
|
||||||
|
{
|
||||||
|
_MyZTransition.Dispose();
|
||||||
|
_MyZTransition = null;
|
||||||
|
}
|
||||||
|
if (_MyContent != null)
|
||||||
|
_MyContent = null;
|
||||||
|
//if (_MyItemRangeID!=null)
|
||||||
|
// _MyItemRangeID = null;
|
||||||
|
//if (_MyItemToID != null)
|
||||||
|
// _MyItemToID = null;
|
||||||
|
//if (_MyItemRangeID != null)
|
||||||
|
// _MyItemRangeID = null;
|
||||||
}
|
}
|
||||||
private void RemoveFromDictionaries()
|
private void RemoveFromDictionaries()
|
||||||
{
|
{
|
||||||
|
@@ -310,6 +310,8 @@ namespace VEPROMS.CSLA.Library
|
|||||||
_CountDisposed++;
|
_CountDisposed++;
|
||||||
_Disposed = true;
|
_Disposed = true;
|
||||||
RemoveFromDictionaries();
|
RemoveFromDictionaries();
|
||||||
|
if (_MyTransition != null)
|
||||||
|
_MyTransition = null;
|
||||||
}
|
}
|
||||||
private void RemoveFromDictionaries()
|
private void RemoveFromDictionaries()
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user