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

Fix memory leak for filters with keyword arguments #157

Merged
merged 1 commit into from
Oct 12, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions ext/liquid_c/variable.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,7 @@ static VALUE try_variable_strict_parse(VALUE uncast_args)
vm_assembler_concat(code, push_keywords_code);
vm_assembler_add_hash_new(code, keyword_arg_count);

// There are no external references to this temporary object, so we can eagerly free it
DATA_PTR(push_keywords_obj) = NULL;
vm_assembler_free(push_keywords_code);
rb_gc_force_recycle(push_keywords_obj); // also acts as a RB_GC_GUARD(push_keywords_obj);
RB_GC_GUARD(push_keywords_obj);
}
vm_assembler_add_filter(code, filter_name, arg_count);
}
Expand Down