Closed Bug 548405 Opened 14 years ago Closed 9 months ago

GC Factor < 200 == gcZeal(2)

Categories

(Core :: JavaScript Engine, defect)

1.9.2 Branch
defect

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: wes, Unassigned)

References

Details

The current algorithm looks like this (where lastBytes is a float):

uint64 triggerBytes = uint64(lastBytes) * uint64(gcTriggerFactor / 100);

When gcTriggerFactor is less than 200, triggerBytes is always === lastBytes, so GC triggers on every allocation.

Andreas suggested on IRC adding an assertion when gcTriggerFactor < 200 to advise embedders of this problem.

MikeM has indicated that he would like to be able to trigger GC more aggressively than when the GC heap size has doubled, and that seems like a reasonable expectation to me.

This may be an option: 

uint64 triggerBytes = uint64(lastBytes * gcTriggerFactor) / 100;

However, this limits the usable range of triggerBytes due to overflow.  Capping gcTriggerFactor in JS_SetGCParameter() or rt->setGCTriggerFactor() would mitigate that risk, although the "maximum possible value which == do not trigger" would change.

Ideas?
A quick fix would be:
uint64 triggerBytes = uint64(uint64(lastBytes) * (gcTriggerFactor / 100.0));

Which would allow floating point math and the correct result.

Per discussion in jsapi IRC it would be nice if it were possible to trigger
this "Auto" GC from a background thread.  However, that might be topic for
another bug...
Assignee: general → nobody
Severity: normal → S3
Status: NEW → RESOLVED
Closed: 9 months ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.