js shell: functions to count finalized objects

RESOLVED FIXED

Status

()

--
enhancement
RESOLVED FIXED
8 years ago
8 years ago

People

(Reporter: igor, Assigned: igor)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: fixed-in-tracemonkey)

Attachments

(1 attachment)

(Assignee)

Description

8 years ago
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.
(Assignee)

Comment 1

8 years ago
Created attachment 476730 [details] [diff] [review]
v1

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+
(Assignee)

Comment 3

8 years ago
http://hg.mozilla.org/tracemonkey/rev/a3ff60f75cb8
Whiteboard: fixed-in-tracemonkey

Comment 4

8 years ago
http://hg.mozilla.org/mozilla-central/rev/a3ff60f75cb8
Status: NEW → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.