Memory-drainAllocationsLog-04.js (593B)
1 // Test that when we shorten the maximum log length, we won't get a longer log 2 // than that new maximum afterwards. 3 4 const root = newGlobal({newCompartment: true}); 5 const dbg = new Debugger(); 6 dbg.addDebuggee(root) 7 8 dbg.memory.trackingAllocationSites = true; 9 10 root.eval([ 11 "this.alloc1 = {};", // line 1 12 "this.alloc2 = {};", // line 2 13 "this.alloc3 = {};", // line 3 14 "this.alloc4 = {};", // line 4 15 ].join("\n")); 16 17 dbg.memory.maxAllocationsLogLength = 1; 18 const allocs = dbg.memory.drainAllocationsLog(); 19 20 // Should have trimmed down to the new maximum length. 21 assertEq(allocs.length, 1);