in reply to Re^4: XML::LibXML memory leak
in thread XML::LibXML memory leak

But I'm a little confused as where to go from here: my $doc = $node->ownerDocument;

{ my $doc = $node->ownerDocument; say "owner=", $doc; if ($doc) { say $_->nodeName for $doc->findnodes("//*"); } }

was just to demonstrate the issue. It shouldn't be part of your code.

I'm also stymied at the moment as I'm getting "Can't locate object method "setOwnerDocument" via package "XML::LibXML::NodeList" at..."

Nodes have owner documents, not result sets. Change the owner of the nodes in the result set.

Can't you just extract the data you need from the nodes instead of keeping the nodes themselves?

Replies are listed 'Best First'.
Re^6: XML::LibXML memory leak
by spstansbury (Monk) on Dec 08, 2010 at 20:31 UTC

    Yes, absolutely! All I need is the data...

    That's what I thought that I was doing with:

    $av = $cve_xc->find('cvss:access-vector', $metrics);

      Ah oops, I thought you were using ->findnodes.

      The only possible things that could match are: 0 elements, 1 element, or multiple elements. I never use ->find, so I don't know what it returns in each of those circumstances, and whether any of those are connected to the document.

        If I were to use ->findnodes how would I go about just extracting the data?