Skip to content

Commit

Permalink
Fix memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
jedel1043 committed May 17, 2023
1 parent 6627500 commit d974269
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
12 changes: 11 additions & 1 deletion boa_engine/src/builtins/function/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,16 @@ unsafe impl Trace for FunctionKind {
custom_trace! {this, {
match this {
Self::Native { function, .. } => {mark(function)}
Self::Ordinary { code, environments, home_object, fields, private_methods, class_object, .. } => {
Self::Ordinary {
code,
environments,
home_object,
fields,
private_methods,
class_object,
script_or_module,
..
} => {
mark(code);
mark(environments);
mark(home_object);
Expand All @@ -278,6 +287,7 @@ unsafe impl Trace for FunctionKind {
mark(elem);
}
mark(class_object);
mark(script_or_module);
}
Self::Async { code, environments, home_object, class_object, script_or_module }
| Self::Generator { code, environments, home_object, class_object, script_or_module}
Expand Down
2 changes: 1 addition & 1 deletion boa_engine/src/job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ pub trait JobQueue {
/// such that execution is prepared to evaluate ECMAScript code at the time of job's invocation.
/// > - Let `scriptOrModule` be `GetActiveScriptOrModule()` at the time `HostEnqueuePromiseJob` is invoked. If realm
/// is not null, each time job is invoked the implementation must perform implementation-defined steps such that
/// scriptOrModule is the active script or module at the time of job's invocation.
/// `scriptOrModule` is the active script or module at the time of job's invocation.
/// > - Jobs must run in the same order as the `HostEnqueuePromiseJob` invocations that scheduled them.
///
/// Of all the requirements, Boa guarantees the first two by its internal implementation of `NativeJob`, meaning
Expand Down
2 changes: 2 additions & 0 deletions boa_engine/src/script.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ impl Script {
///
/// Note that this won't run any scheduled promise jobs; you need to call [`Context::run_jobs`]
/// on the context or [`JobQueue::run_jobs`] on the provided queue to run them.
///
/// [`JobQueue::run_jobs`]: crate::job::JobQueue::run_jobs
pub fn evaluate(&self, context: &mut Context<'_>) -> JsResult<JsValue> {
let _timer = Profiler::global().start_event("Execution", "Main");

Expand Down

0 comments on commit d974269

Please sign in to comment.