Added Memory Tracking Code

This commit is contained in:
Rich
2012-05-21 13:34:22 +00:00
parent c8de9f8538
commit ab1cd8af42
202 changed files with 4617 additions and 122 deletions

View File

@@ -25,7 +25,7 @@ namespace VEPROMS.CSLA.Library
/// </summary>
[Serializable()]
[TypeConverter(typeof(ContentPartConverter))]
public partial class ContentPart : BusinessBase<ContentPart>, IVEHasBrokenRules
public partial class ContentPart : BusinessBase<ContentPart>, IVEHasBrokenRules, IDisposable
{
#region Log4Net
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
@@ -349,6 +349,34 @@ namespace VEPROMS.CSLA.Library
MarkAsChild();
Fetch(dr);
}
private bool _Disposed = false;
private static int _CountCreated = 0;
private static int _CountDisposed = 0;
private static int _CountFinalized = 0;
private static int IncrementCountCreated
{ get { return ++_CountCreated; } }
private int _CountWhenCreated = IncrementCountCreated;
public static int CountCreated
{ get { return _CountCreated; } }
public static int CountNotDisposed
{ get { return _CountCreated - _CountDisposed; } }
public static int CountNotFinalized
{ get { return _CountCreated - _CountFinalized; } }
~ContentPart()
{
_CountFinalized++;
}
public void Dispose()
{
if (_Disposed) return;
_CountDisposed++;
_Disposed = true;
if (_MyItem != null)
{
_MyItem.Dispose();
_MyItem = null;
}
}
#endregion
#region Data Access Portal
private void Fetch(SafeDataReader dr)