Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - First prototype for new JsString using UTF-16 #1659

Closed
wants to merge 17 commits into from
Closed
Prev Previous commit
Next Next commit
Fix Drop of JsString
jedel1043 committed Oct 10, 2022
commit 01da4020ac27c0a8ba185c479100b1bb2a0107bd
8 changes: 7 additions & 1 deletion boa_engine/src/string.rs
Original file line number Diff line number Diff line change
@@ -1148,7 +1148,13 @@ impl Drop for JsString {
inner.data.as_mut_ptr(),
inner.len,
));
dealloc((inner as *mut RawJsString).cast(), Layout::for_value(inner));

let layout = Layout::array::<u16>(inner.len)
.and_then(|layout| Layout::for_value(inner).extend(layout))
.expect("failed to get the string memory layout")
.0
.pad_to_align();
dealloc((inner as *mut RawJsString).cast(), layout);
}
}
}