mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Stop artificially constraining the size of the GC heap.
This commit is contained in:
parent
3f17a49564
commit
6dc9f52633
1 changed files with 11 additions and 0 deletions
|
@ -50,6 +50,7 @@ use servo_util::task::spawn_named_with_send_on_failure;
|
||||||
use geom::point::Point2D;
|
use geom::point::Point2D;
|
||||||
use js::jsapi::{JS_SetWrapObjectCallbacks, JS_SetGCZeal, JS_DEFAULT_ZEAL_FREQ, JS_GC};
|
use js::jsapi::{JS_SetWrapObjectCallbacks, JS_SetGCZeal, JS_DEFAULT_ZEAL_FREQ, JS_GC};
|
||||||
use js::jsapi::{JSContext, JSRuntime};
|
use js::jsapi::{JSContext, JSRuntime};
|
||||||
|
use js::jsapi::{JS_SetGCParameter, JSGC_MAX_BYTES};
|
||||||
use js::rust::{Cx, RtUtils};
|
use js::rust::{Cx, RtUtils};
|
||||||
use js::rust::with_compartment;
|
use js::rust::with_compartment;
|
||||||
use js;
|
use js;
|
||||||
|
@ -62,6 +63,7 @@ use std::cell::RefCell;
|
||||||
use std::comm::{channel, Sender, Receiver, Select};
|
use std::comm::{channel, Sender, Receiver, Select};
|
||||||
use std::mem::replace;
|
use std::mem::replace;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
use std::u32;
|
||||||
|
|
||||||
local_data_key!(pub StackRoots: *const RootCollection)
|
local_data_key!(pub StackRoots: *const RootCollection)
|
||||||
|
|
||||||
|
@ -324,6 +326,15 @@ impl ScriptTask {
|
||||||
ptr.is_not_null()
|
ptr.is_not_null()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Unconstrain the runtime's threshold on nominal heap size, to avoid
|
||||||
|
// triggering GC too often if operating continuously near an arbitrary
|
||||||
|
// finite threshold. This leaves the maximum-JS_malloc-bytes threshold
|
||||||
|
// still in effect to cause periodical, and we hope hygienic,
|
||||||
|
// last-ditch GCs from within the GC's allocator.
|
||||||
|
unsafe {
|
||||||
|
JS_SetGCParameter(js_runtime.ptr, JSGC_MAX_BYTES, u32::MAX);
|
||||||
|
}
|
||||||
|
|
||||||
let js_context = js_runtime.cx();
|
let js_context = js_runtime.cx();
|
||||||
assert!({
|
assert!({
|
||||||
let ptr: *mut JSContext = (*js_context).ptr;
|
let ptr: *mut JSContext = (*js_context).ptr;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue