Browse Source

Remove Cruft

Adam Johnson 12 years ago
parent
commit
bb2146b3a3
  1. 49
      Sources/Plasma/PubUtilLib/plResMgr/plResManager.cpp
  2. 1
      Sources/Plasma/PubUtilLib/plResMgr/plResManager.h
  3. 3
      Sources/Tools/MaxMain/plPluginResManager.cpp

49
Sources/Plasma/PubUtilLib/plResMgr/plResManager.cpp

@ -96,7 +96,6 @@ static void ILog(uint8_t level, const char* format, ...)
plResManager::plResManager(): plResManager::plResManager():
fInited(false), fInited(false),
fPageOutHint(0),
fDispatch(nil), fDispatch(nil),
fReadingObject( false ), fReadingObject( false ),
fCurCloneID(0), fCurCloneID(0),
@ -492,47 +491,21 @@ public:
} }
}; };
#if HS_BUILD_FOR_UNIX
static void sLeakReportRedirectFn( const char message[] )
{
hsUNIXStream stream;
stream.Open( "resMgrMemLeaks.txt", "at" );
stream.WriteString( message );
stream.Close();
}
static bool sFirstTime = true;
#endif
// Just the scene nodes (and objects referenced by the node... and so on) // Just the scene nodes (and objects referenced by the node... and so on)
void plResManager::IPageOutSceneNodes(bool forceAll) void plResManager::IPageOutSceneNodes(bool forceAll)
{ {
plSynchEnabler ps(false); // disable dirty tracking while paging out plSynchEnabler ps(false); // disable dirty tracking while paging out
#if HS_BUILD_FOR_UNIX
if (sFirstTime)
{
hsUNIXStream stream;
stream.Open("resMgrMemLeaks.txt", "wt");
stream.Close();
sFirstTime = false;
}
hsDebugMessageProc oldProc = hsSetStatusMessageProc(sLeakReportRedirectFn);
#endif
if (forceAll) if (forceAll)
{ {
hsStatusMessage( "--- plResManager Object Leak Report (BEGIN) ---" ); hsStatusMessage( "--- plResManager Object Leak Report (BEGIN) ---" );
plPageOutIterator iter(this, uint16_t(-1)); plPageOutIterator iter(this, static_cast<uint16_t>(-1));
hsStatusMessage( "--- plResManager Object Leak Report (END) ---" ); hsStatusMessage( "--- plResManager Object Leak Report (END) ---" );
} }
else else
{ {
plPageOutIterator iter(this, fPageOutHint); plPageOutIterator iter(this, 0);
} }
#if HS_BUILD_FOR_UNIX
hsSetStatusMessageProc( oldProc );
#endif
} }
//// FindKey ///////////////////////////////////////////////////////////////// //// FindKey /////////////////////////////////////////////////////////////////
@ -1582,7 +1555,7 @@ static void sIReportLeak(plKeyImp* key, plRegistryPageNode* page)
if (!alreadyDone) if (!alreadyDone)
{ {
// Print out page header // Print out page header
hsStatusMessageF(" Leaks in page %s>%s[%08x]:\n", lastPage->GetPageInfo().GetAge().c_str(), lastPage->GetPageInfo().GetPage().c_str(), lastPage->GetPageInfo().GetLocation().GetSequenceNumber()); hsStatusMessageF("\tLeaks in page %s>%s[%08x]:\n", lastPage->GetPageInfo().GetAge().c_str(), lastPage->GetPageInfo().GetPage().c_str(), lastPage->GetPageInfo().GetLocation().GetSequenceNumber());
alreadyDone = true; alreadyDone = true;
} }
@ -1590,14 +1563,14 @@ static void sIReportLeak(plKeyImp* key, plRegistryPageNode* page)
if (refsLeft == 0) if (refsLeft == 0)
return; return;
char tempStr2[128]; plStringStream ss;
if (key->ObjectIsLoaded() == nil) ss << "\t\t" << plFactory::GetNameOfClass(key->GetUoid().GetClassType()) << ": ";
sprintf(tempStr2, "(key only, %d refs left)", refsLeft); ss << key->GetUoid().StringIze() << " ";
if (key->ObjectIsLoaded())
ss << "- " << key->GetDataLen() << " bytes - " << refsLeft << " refs left";
else else
sprintf(tempStr2, "- %d bytes - %d refs left", key->GetDataLen(), refsLeft); ss << "(key only, " << refsLeft << " refs left)";
hsStatusMessage(ss.GetString().c_str());
hsStatusMessageF(" %s: %s %s\n", plFactory::GetNameOfClass(key->GetUoid().GetClassType()),
key->GetUoid().StringIze().c_str(), tempStr2);
} }
//// UnloadPageObjects /////////////////////////////////////////////////////// //// UnloadPageObjects ///////////////////////////////////////////////////////
@ -1628,7 +1601,7 @@ void plResManager::UnloadPageObjects(plRegistryPageNode* pageNode, uint16_t clas
plUnloadObjectsIterator iterator; plUnloadObjectsIterator iterator;
if (classIndexHint != uint16_t(-1)) if (classIndexHint != static_cast<uint16_t>(-1))
pageNode->IterateKeys(&iterator, classIndexHint); pageNode->IterateKeys(&iterator, classIndexHint);
else else
pageNode->IterateKeys(&iterator); pageNode->IterateKeys(&iterator);

1
Sources/Plasma/PubUtilLib/plResMgr/plResManager.h

@ -209,7 +209,6 @@ protected:
plRegistryPageNode* CreatePage(const plLocation& location, const char* age, const char* page); plRegistryPageNode* CreatePage(const plLocation& location, const char* age, const char* page);
bool fInited; bool fInited;
uint16_t fPageOutHint;
// True if we're reading in an object. We only read one object at a time // True if we're reading in an object. We only read one object at a time
bool fReadingObject; bool fReadingObject;

3
Sources/Tools/MaxMain/plPluginResManager.cpp

@ -60,9 +60,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
plKey plPluginResManager::NameToLoc(const plString& age, const plString& page, int32_t sequenceNumber, bool itinerant) plKey plPluginResManager::NameToLoc(const plString& age, const plString& page, int32_t sequenceNumber, bool itinerant)
{ {
// Hack for now--always prefer paging out sceneNodes first
fPageOutHint = plSceneNode::Index();
// Get or create our page // Get or create our page
plRegistryPageNode* pageNode = INameToPage(age, page, sequenceNumber, itinerant); plRegistryPageNode* pageNode = INameToPage(age, page, sequenceNumber, itinerant);
hsAssert(pageNode != nil, "No page returned from INameToPage(), shouldn't be possible"); hsAssert(pageNode != nil, "No page returned from INameToPage(), shouldn't be possible");

Loading…
Cancel
Save