The documentation for LibXML::XML::Document#find mentions that following code style needs to be used to avoid seg faults:
nodes = doc.find('/header')
nodes.each do |node|
... do stuff ...
end
Is this all I need to do? Below the example code box there is some commented out code:
# nodes = nil # GC.start
Do I need to include this code as well to be sure of avoiding a seg fault? I wouldn't have thought that the style shown in the first block of code would help much with reference problems. I tried it without the commented out code and have had no problems after processing a large number of files but maybe it's something that crops up under rare circumstances.