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

Memory leak #181

Closed
vovanmozg opened this issue Jan 24, 2022 · 2 comments
Closed

Memory leak #181

vovanmozg opened this issue Jan 24, 2022 · 2 comments

Comments

@vovanmozg
Copy link
Contributor

ruby 3.0.0
libxml-ruby: 3.2.2
libxml: 2.9.10
Debian 11

Demo:

  def test_remove_leak
    doc = LibXML::XML::Document.new('1.0')
    10.times do
      before = `ps -o rss= -p #{Process.pid}`.chop
      GC.start
      100000.times do
        doc.root = LibXML::XML::Node.new('node')
      end
      GC.start
      puts before + ' / ' + `ps -o rss= -p #{Process.pid}`
    end
  end

Output:

25108 / 40276
40276 / 55852
55852 / 71428
71428 / 87268
87268 / 102844
102844 / 118420
118420 / 133996
133996 / 149572
149572 / 165412
165412 / 180988
@vovanmozg
Copy link
Contributor Author

Demo 2:

  def test_remove_leak
    10.times do
      before = `ps -o rss= -p #{Process.pid}`.chop
      GC.start
      100000.times do
        doc = LibXML::XML::Document.new('1.0')
        doc.root = LibXML::XML::Node.new('node')
        doc.root.remove!
      end
      GC.start
      puts before + ' / ' + `ps -o rss= -p #{Process.pid}`
    end
  end

@cfis
Copy link
Member

cfis commented May 22, 2022

This was fixed in #180.

@cfis cfis closed this as completed May 22, 2022
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

No branches or pull requests

2 participants