debug only: warn when stacks of event queues get surprisingly deep. should speed future attempts to debug problems like bug 206947. r=brendan

git-svn-id: svn://10.0.0.236/trunk@145575 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
danm-moz%comcast.net 2003-08-05 00:01:20 +00:00
parent 7125c96b9a
commit 64b4daa656

View File

@ -47,6 +47,10 @@
#include "prlog.h"
#ifdef NS_DEBUG
#include "prprf.h"
#endif
#if defined(PR_LOGGING) && defined(DEBUG_danm)
/* found these logs useful in conjunction with netlibStreamEvent logging
from netwerk. */
@ -509,6 +513,21 @@ nsEventQueueImpl::AppendQueue(nsIEventQueue *aQueue)
*/
rv = NS_ERROR_NO_INTERFACE;
#ifdef NS_DEBUG
int depth = 0;
nsEventQueueImpl *next = this;
while (next && depth < 100) {
next = NS_STATIC_CAST(nsEventQueueImpl *, next->mYoungerQueue);
++depth;
}
if (depth > 5) {
char warning[80];
PR_snprintf(warning, sizeof(warning),
"event queue chain length is %d. this is almost certainly a leak.", depth);
NS_WARNING(warning);
}
#endif
// (be careful doing this outside nsEventQueueService's mEventQMonitor)
GetYoungest(getter_AddRefs(end));