Nokogiri related memory not freed when `inner_html=` is called
vanboom opened this issue · comments
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.
odf-report/lib/odf-report/field.rb
Line 22 in 16f5b38
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?
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.
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.
Could you consider my PR please? I have tested it extensively with over 50,000 documents generated and it is working perfectly.
Thank you!