Changeset 12512 in webkit for trunk/JavaScriptCore/kjs/nodes.cpp


Ignore:
Timestamp:
Jan 31, 2006, 10:24:32 PM (19 years ago)
Author:
mjs
Message:

Reviewed by Darin.


  • fixed leak of hundreds of thousands of JS parser nodes on the layout tests, and added an exit counter that would catch them
  • kjs/nodes.cpp: (NodeCounter::~NodeCounter): Added debug-only node counter. (Node::Node): (Node::~Node):
  • kxmlcore/VectorTraits.h: Simple classes like RefPtr do in fact need destruction.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/nodes.cpp

    r12489 r12512  
    8686// ------------------------------ Node -----------------------------------------
    8787
     88
     89#ifndef NDEBUG
     90struct NodeCounter {
     91    static int count;
     92    ~NodeCounter() { if (count != 0) fprintf(stderr, "LEAK: %d KJS::Node\n", count); }
     93};
     94int NodeCounter::count = 0;
     95static NodeCounter nodeImplCounter;
     96#endif NDEBUG
     97
     98
    8899Node::Node()
    89100{
     101#ifndef NDEBUG
     102    ++NodeCounter::count;
     103#endif
    90104  line = Lexer::curr()->lineNo();
    91105  sourceURL = Lexer::curr()->sourceURL();
     
    96110Node::~Node()
    97111{
     112#ifndef NDEBUG
     113    --NodeCounter::count;
     114#endif
    98115}
    99116
Note: See TracChangeset for help on using the changeset viewer.