SVN commit 852579 by orlovich: Make sure to have breaks jump to before the EndForIn instruction so that the for in stack entry isn't leaked. Fixes explosive memory consumption on http://www.chron.com/ stories. (Perhaps following olliej's approach and using GCable objects for the context would be a good idea, since it'd simplify all of this, and lighten ExecState) BUG: 165847 M +6 -3 nodes2bytecode.cpp --- branches/KDE/4.1/kdelibs/kjs/nodes2bytecode.cpp #852578:852579 @@ -1273,11 +1273,14 @@ // The end address is here (#2 since return val..) CodeGen::patchJumpToNext(comp, block, fetchNext, 2); - // Cleanup + // The looping action ends here.. We need to do it before the EndForIn instruction so we always cleanup + // right on breaks. + comp->exitLoop(this, block); + comp->popNest(); // Remove the cleanup entry.. Note that the breaks go to before here.. + + // Cleanup. CodeGen::emitOp(comp, block, Op_EndForIn); - comp->exitLoop(this, block); - comp->popNest(); // Remove the cleanup entry.. Note that the breaks go to before here.. } // Helper for continue/break -- emits stack cleanup call if needed,