Skip to content

Lightpanda: the headless browser designed for AI and automation

disable Zig 0.16 signal_stack_size

Karl Seguin0871b6a8daf4
diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml
index 97942f6ce..246e760d4 100644
--- a/.github/workflows/e2e-test.yml
+++ b/.github/workflows/e2e-test.yml
@@ -237,7 +237,7 @@ jobs:
needs: zig-build-release
env:
- MAX_VmHWM: 29000 # 29MB (KB)
+ MAX_VmHWM: 28000 # 28MB (KB)
MAX_CG_PEAK: 8000 # 8MB (KB)
MAX_AVG_DURATION: 17
diff --git a/build.zig b/build.zig
index c042bf9ca..b87fc0be6 100644
--- a/build.zig
+++ b/build.zig
@@ -248,6 +248,7 @@ fn linkHtml5Ever(b: *Build, mod: *Build.Module) !void {
const exec_cargo = b.addSystemCommand(&.{
"cargo", "build",
"--profile", if (is_debug) "dev" else "release",
+ "--features", if (is_debug) "memstats" else "",
"--manifest-path", "src/html5ever/Cargo.toml",
});
diff --git a/src/html5ever/Cargo.toml b/src/html5ever/Cargo.toml
index 216f21098..f3818f822 100644
--- a/src/html5ever/Cargo.toml
+++ b/src/html5ever/Cargo.toml
@@ -12,8 +12,8 @@ crate-type = ["cdylib", "staticlib"]
html5ever = "0.39.0"
string_cache = "0.9.0"
typed-arena = "2.0.2"
-tikv-jemallocator = {version = "0.6.1", features = ["stats"]}
-tikv-jemalloc-ctl = {version = "0.6.1", features = ["stats"]}
+tikv-jemallocator = { version = "0.6.1", features = ["stats"], optional = true }
+tikv-jemalloc-ctl = { version = "0.6.1", features = ["stats"], optional = true }
xml5ever = "0.39.0"
encoding_rs = "0.8"
idna = "1.1.0"
@@ -22,3 +22,6 @@ url = "2.5.8"
[profile.release]
lto = true
codegen-units = 1
+
+[features]
+memstats = ["dep:tikv-jemallocator", "dep:tikv-jemalloc-ctl"]
diff --git a/src/html5ever/lib.rs b/src/html5ever/lib.rs
index 8504da071..4b1e23cec 100644
--- a/src/html5ever/lib.rs
+++ b/src/html5ever/lib.rs
@@ -21,7 +21,7 @@ mod sink;
mod types;
mod url;
-#[cfg(debug_assertions)]
+#[cfg(feature = "memstats")]
#[global_allocator]
static GLOBAL: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;
@@ -594,14 +594,14 @@ pub extern "C" fn html5ever_attribute_iterator_count(c_iter: *const c_void) -> u
return iter.vec.len();
}
-#[cfg(debug_assertions)]
+#[cfg(feature = "memstats")]
#[repr(C)]
pub struct Memory {
pub resident: usize,
pub allocated: usize,
}
-#[cfg(debug_assertions)]
+#[cfg(feature = "memstats")]
#[no_mangle]
pub extern "C" fn html5ever_get_memory_usage() -> Memory {
use tikv_jemalloc_ctl::{epoch, stats};
diff --git a/src/main.zig b/src/main.zig
index 7e7ed15f9..f8abbfc75 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -27,6 +27,10 @@ const Config = lp.Config;
const SigHandler = @import("Sighandler.zig");
pub const panic = lp.crash_handler.panic;
+pub const std_options: std.Options = .{
+ .signal_stack_size = null,
+};
+
pub fn main(init: std.process.Init) !void {
// allocator
// - in Debug mode we use the General Purpose Allocator to detect memory leaks