aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/script/script_task.rs
diff options
context:
space:
mode:
authorMs2ger <ms2ger@gmail.com>2014-08-19 15:02:01 +0200
committerMs2ger <ms2ger@gmail.com>2014-08-19 15:02:01 +0200
commit6dc9f52633d375195c7f64e41635d25d1fa067f6 (patch)
tree4eafe898ef386a1c8f7f4fa09b44fa9a3a8fd911 /src/components/script/script_task.rs
parent3f17a495640cb7f859401ea20267d52122f3f519 (diff)
downloadservo-6dc9f52633d375195c7f64e41635d25d1fa067f6.tar.gz
servo-6dc9f52633d375195c7f64e41635d25d1fa067f6.zip
Stop artificially constraining the size of the GC heap.
Diffstat (limited to 'src/components/script/script_task.rs')
-rw-r--r--src/components/script/script_task.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/components/script/script_task.rs b/src/components/script/script_task.rs
index f7873ca3c24..ce0d18b8c87 100644
--- a/src/components/script/script_task.rs
+++ b/src/components/script/script_task.rs
@@ -50,6 +50,7 @@ use servo_util::task::spawn_named_with_send_on_failure;
use geom::point::Point2D;
use js::jsapi::{JS_SetWrapObjectCallbacks, JS_SetGCZeal, JS_DEFAULT_ZEAL_FREQ, JS_GC};
use js::jsapi::{JSContext, JSRuntime};
+use js::jsapi::{JS_SetGCParameter, JSGC_MAX_BYTES};
use js::rust::{Cx, RtUtils};
use js::rust::with_compartment;
use js;
@@ -62,6 +63,7 @@ use std::cell::RefCell;
use std::comm::{channel, Sender, Receiver, Select};
use std::mem::replace;
use std::rc::Rc;
+use std::u32;
local_data_key!(pub StackRoots: *const RootCollection)
@@ -324,6 +326,15 @@ impl ScriptTask {
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();
assert!({
let ptr: *mut JSContext = (*js_context).ptr;