NS_LogRelease(void* aPtr, nsrefcnt aRefcnt, const char* aClazz) { #ifdef NS_IMPL_REFCNT_LOGGING ASSERT_ACTIVITY_IS_LEGAL; if (!gInitialized) InitTraceLog(); if (gLogging) { LOCK_TRACELOG(); if (gBloatLog) { BloatEntry* entry = GetBloatEntry(aClazz, 0); if (entry) { entry->Release(aRefcnt); } } bool loggingThisType = (!gTypesToLog || LogThisType(aClazz)); intptr_t serialno = 0; if (gSerialNumbers && loggingThisType) { serialno = GetSerialNumber(aPtr, false); NS_ASSERTION(serialno != 0, "Serial number requested for unrecognized pointer! " "Are you memmoving a refcounted object?"); int32_t* count = GetRefCount(aPtr); if(count) (*count)--; } bool loggingThisObject = (!gObjectsToLog || LogThisObj(serialno)); if (gRefcntsLog && loggingThisType && loggingThisObject) { if (gLogToLeaky) { (*leakyLogRelease)(aPtr, aRefcnt + 1, aRefcnt); } else { // Can't use PR_LOG(), b/c it truncates the line fprintf(gRefcntsLog, "\n<%s> 0x%08X %ld Release %d\n", aClazz, NS_PTR_TO_INT32(aPtr), serialno, aRefcnt); nsTraceRefcntImpl::WalkTheStack(gRefcntsLog); fflush(gRefcntsLog); } } // Here's the case where MOZ_COUNT_DTOR was not used, // yet we still want to see deletion information: if (aRefcnt == 0 && gAllocLog && loggingThisType && loggingThisObject) { fprintf(gAllocLog, "\n<%s> 0x%08X %ld Destroy\n", aClazz, NS_PTR_TO_INT32(aPtr), serialno); nsTraceRefcntImpl::WalkTheStack(gAllocLog); } if (aRefcnt == 0 && gSerialNumbers && loggingThisType) { RecycleSerialNumberPtr(aPtr); } UNLOCK_TRACELOG(); } #endif }