sandrods / odf-report

Generates ODF files, given a template (.odt) and data, replacing tags

Home Page:http://sandrods.github.com/odf-report

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nokogiri related memory not freed when `inner_html=` is called

vanboom opened this issue · comments

commented

sparklemotion/nokogiri#2349 (comment)

Calling inner_html= is memory expensive.

The logic in field.rb should only call inner_html= to replace the node contents if a change has been made to the node.

content.inner_html = txt

But there is always going to happen some kind of change.
Even if you don't provide some value, you have to at least remove the placeholder, right?

commented

Yes - gsub will return true if the placeholder is in the document and therefore a substitution is made. If the placeholder does not exist in the document, there would be no need to replace the inner_html as nothing would be changed. Thanks for your consideration.

commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

commented

Could you consider my PR please? I have tested it extensively with over 50,000 documents generated and it is working perfectly.

Thank you!