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 in the VM assembler #161

Merged
merged 1 commit into from
Oct 18, 2021
Merged

Conversation

peterzhu2118
Copy link
Member

The vm_assembler_element_t is not freed when the vm_assembler_pool_t is freed. This causes a memory leak to occur.

This script demonstrates the issue.

require "liquid"
require_relative "lib/liquid/c"

1_000_000.times do |i|
  Liquid::Template.parse("{{ value | default: 'None', allow_false: true }}")
end

puts `ps -o rss -p #{$$}`.chomp.split("\n").last.to_i

Before this patch: 124824

After this patch: 31116

@peterzhu2118 peterzhu2118 merged commit 54dc110 into master Oct 18, 2021
@peterzhu2118 peterzhu2118 deleted the pz-vm-assembler-mem-leak branch October 18, 2021 18:16
@shopify-shipit shopify-shipit bot temporarily deployed to rubygems February 8, 2022 20:25 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants