Closed Bug 597906 Opened 14 years ago Closed 14 years ago

js shell: functions to count finalized objects

Categories

(Core :: JavaScript Engine, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: igor, Assigned: igor)

References

Details

(Whiteboard: fixed-in-tracemonkey)

Attachments

(1 file)

To a write a leak regression test for js shell currently one can either try to use rather unreliable performance degradation characteristics of the leak or use the countHeap function tp observe the heap growth or that GC cannot collect some things. Unfortunately with the consevative GC it is not easy to use countHeap reliably as it is hard to estimate the number of GC things reachable through the stack and registers.

So as an alternative to the countHeap I suggest to have a special purpose object that during the finalization would increase some global counter and expose that counter in the shell. Then one can observe the leak via storing this the special object in the structure that should be GC-ed and comparing the counter before and after the GC. A conservative GC can still spoil this picture but I have found that by running the corresponding test code twice one can reliably make sure that the native stack  and registers do not contain references to GC things from the first run.
Attached patch v1Splinter Review
The patch adds two functions to js shell. makeFinalizeObserver() creates the object which finalization increases the counter and finalizeCount() returns the counter.
Attachment #476730 - Flags: review?(jorendorff)
Comment on attachment 476730 [details] [diff] [review]
v1

Good idea.

>+"  get a special object which finalization increases the counter returned\n"

"which" should be "whose" here.
Attachment #476730 - Flags: review?(jorendorff) → review+
http://hg.mozilla.org/tracemonkey/rev/a3ff60f75cb8
Whiteboard: fixed-in-tracemonkey
http://hg.mozilla.org/mozilla-central/rev/a3ff60f75cb8
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: