Count various classes in leak/bloat logs. r=waterson@netscape.com

This commit is contained in:
dbaron%fas.harvard.edu 2000-06-15 02:18:32 +00:00
parent dd0c6672be
commit 5695245ccb
5 changed files with 33 additions and 0 deletions

View File

@ -24,6 +24,7 @@
#include "xptiprivate.h" #include "xptiprivate.h"
MOZ_DECL_CTOR_COUNTER(xptiFile);
xptiFile::xptiFile() xptiFile::xptiFile()
: mSize(), : mSize(),
@ -32,6 +33,7 @@ xptiFile::xptiFile()
mGuts(nsnull) mGuts(nsnull)
{ {
// empty // empty
MOZ_COUNT_CTOR(xptiFile);
} }
xptiFile::xptiFile(const nsInt64& aSize, xptiFile::xptiFile(const nsInt64& aSize,
@ -50,6 +52,8 @@ xptiFile::xptiFile(const nsInt64& aSize,
if(aHeader) if(aHeader)
SetHeader(aHeader); SetHeader(aHeader);
MOZ_COUNT_CTOR(xptiFile);
} }
xptiFile::xptiFile(const xptiFile& r, xptiWorkingSet* aWorkingSet, xptiFile::xptiFile(const xptiFile& r, xptiWorkingSet* aWorkingSet,
@ -64,12 +68,16 @@ xptiFile::xptiFile(const xptiFile& r, xptiWorkingSet* aWorkingSet,
if(cloneGuts && r.mGuts) if(cloneGuts && r.mGuts)
mGuts = r.mGuts->Clone(); mGuts = r.mGuts->Clone();
MOZ_COUNT_CTOR(xptiFile);
} }
xptiFile::~xptiFile() xptiFile::~xptiFile()
{ {
if(mGuts) if(mGuts)
delete mGuts; delete mGuts;
MOZ_COUNT_DTOR(xptiFile);
} }
PRBool PRBool

View File

@ -54,10 +54,14 @@ xptiFileType::Type xptiFileType::GetType(const char* name)
/***************************************************************************/ /***************************************************************************/
MOZ_DECL_CTOR_COUNTER(xptiAutoLog);
xptiAutoLog::xptiAutoLog(xptiInterfaceInfoManager* mgr, xptiAutoLog::xptiAutoLog(xptiInterfaceInfoManager* mgr,
nsILocalFile* logfile, PRBool append) nsILocalFile* logfile, PRBool append)
: mMgr(nsnull), mOldFileDesc(nsnull) : mMgr(nsnull), mOldFileDesc(nsnull)
{ {
MOZ_COUNT_CTOR(xptiAutoLog);
if(mgr && logfile) if(mgr && logfile)
{ {
PRFileDesc* fd; PRFileDesc* fd;
@ -87,6 +91,8 @@ xptiAutoLog::xptiAutoLog(xptiInterfaceInfoManager* mgr,
xptiAutoLog::~xptiAutoLog() xptiAutoLog::~xptiAutoLog()
{ {
MOZ_COUNT_DTOR(xptiAutoLog);
if(mMgr) if(mMgr)
{ {
PRFileDesc* fd = mMgr->SetOpenLogFile(mOldFileDesc); PRFileDesc* fd = mMgr->SetOpenLogFile(mOldFileDesc);

View File

@ -24,10 +24,14 @@
#include "xptiprivate.h" #include "xptiprivate.h"
MOZ_DECL_CTOR_COUNTER(xptiTypelibGuts);
xptiTypelibGuts::xptiTypelibGuts(XPTHeader* aHeader) xptiTypelibGuts::xptiTypelibGuts(XPTHeader* aHeader)
: mHeader(aHeader), : mHeader(aHeader),
mInfoArray(nsnull) mInfoArray(nsnull)
{ {
MOZ_COUNT_CTOR(xptiTypelibGuts);
NS_ASSERTION(mHeader, "bad param"); NS_ASSERTION(mHeader, "bad param");
if(mHeader->num_interfaces) if(mHeader->num_interfaces)
@ -42,6 +46,8 @@ xptiTypelibGuts::xptiTypelibGuts(XPTHeader* aHeader)
xptiTypelibGuts::~xptiTypelibGuts() xptiTypelibGuts::~xptiTypelibGuts()
{ {
MOZ_COUNT_DTOR(xptiTypelibGuts);
if(mHeader && mInfoArray) if(mHeader && mInfoArray)
for(PRUint16 i = 0; i < GetInfoCount(); ++i) for(PRUint16 i = 0; i < GetInfoCount(); ++i)
NS_IF_RELEASE(mInfoArray[i]); NS_IF_RELEASE(mInfoArray[i]);

View File

@ -40,6 +40,8 @@ xpti_CompareIIDs(const void *v1, const void *v2)
return (PRIntn) ((const nsID*)v1)->Equals(*((const nsID*)v2)); return (PRIntn) ((const nsID*)v1)->Equals(*((const nsID*)v2));
} }
MOZ_DECL_CTOR_COUNTER(xptiWorkingSet);
xptiWorkingSet::xptiWorkingSet() xptiWorkingSet::xptiWorkingSet()
: mFileCount(0), : mFileCount(0),
mMaxFileCount(0), mMaxFileCount(0),
@ -60,6 +62,7 @@ xptiWorkingSet::xptiWorkingSet()
mFileMergeOffsetMap(nsnull), mFileMergeOffsetMap(nsnull),
mZipItemMergeOffsetMap(nsnull) mZipItemMergeOffsetMap(nsnull)
{ {
MOZ_COUNT_CTOR(xptiWorkingSet);
// do nothing else... // do nothing else...
} }
@ -135,6 +138,8 @@ xptiWorkingSet::ClearZipItems()
xptiWorkingSet::~xptiWorkingSet() xptiWorkingSet::~xptiWorkingSet()
{ {
MOZ_COUNT_DTOR(xptiWorkingSet);
ClearFiles(); ClearFiles();
ClearZipItems(); ClearZipItems();
ClearHashTables(); ClearHashTables();

View File

@ -24,11 +24,13 @@
#include "xptiprivate.h" #include "xptiprivate.h"
MOZ_DECL_CTOR_COUNTER(xptiZipItem);
xptiZipItem::xptiZipItem() xptiZipItem::xptiZipItem()
: mName(nsnull), : mName(nsnull),
mGuts(nsnull) mGuts(nsnull)
{ {
MOZ_COUNT_CTOR(xptiZipItem);
// empty // empty
} }
@ -39,6 +41,8 @@ xptiZipItem::xptiZipItem(const char* aName,
: mName(aName), : mName(aName),
mGuts(nsnull) mGuts(nsnull)
{ {
MOZ_COUNT_CTOR(xptiZipItem);
NS_ASSERTION(aWorkingSet,"bad param"); NS_ASSERTION(aWorkingSet,"bad param");
mName = XPT_STRDUP(aWorkingSet->GetStringArena(), aName); mName = XPT_STRDUP(aWorkingSet->GetStringArena(), aName);
@ -51,6 +55,8 @@ xptiZipItem::xptiZipItem(const xptiZipItem& r, xptiWorkingSet* aWorkingSet,
: mName(nsnull), : mName(nsnull),
mGuts(nsnull) mGuts(nsnull)
{ {
MOZ_COUNT_CTOR(xptiZipItem);
NS_ASSERTION(aWorkingSet,"bad param"); NS_ASSERTION(aWorkingSet,"bad param");
mName = XPT_STRDUP(aWorkingSet->GetStringArena(), r.mName); mName = XPT_STRDUP(aWorkingSet->GetStringArena(), r.mName);
@ -60,6 +66,8 @@ xptiZipItem::xptiZipItem(const xptiZipItem& r, xptiWorkingSet* aWorkingSet,
xptiZipItem::~xptiZipItem() xptiZipItem::~xptiZipItem()
{ {
MOZ_COUNT_DTOR(xptiZipItem);
if(mGuts) if(mGuts)
delete mGuts; delete mGuts;
} }