可以尝试下SAX接口。
SAX接口使用流式解析方式,不用预先载入整个DOM树结构,大大减少了内存占用量,解析的速度也更快,只是会用到回调函数,编码稍复杂一些。

参考:
         Developerworks:
http://www.ibm.com/developerworks/library/x-xmlperl2/index.html

          Stackoverflow:
http://stackoverflow.com/questions/1330373/how-do-i-use-xmllibxml-to-parse-xml-using-sax



在 2013年5月27日下午9:26,jyfeather <[email protected]>写道:

> http://perl-begin.org/uses/xml/#what-to-avoid
>
> 上面建议不用xml::simple, 推荐XML-LibXML
>
> On Sunday, May 26, 2013 8:46:34 AM UTC+8, kevin_li wrote:
>>
>> 请问有没有稍微轻量点的 读XML的 模块?
>>
>> 我使用XML::DOM::Parser 读一个 60M左右的XML 就占了1G 多内存,
>> 处理完毕后,dispose 释放 总是卡在某个地方 很诡异。
>>
>> 谢谢:)
>>
>>
>>  --
> 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
> 要退订此论坛并停止接收此论坛的电子邮件,请发送电子邮件到 [email protected]。
> 要向此网上论坛发帖,请发送电子邮件至 [email protected]。
> 通过以下网址访问此论坛:http://groups.google.com/group/perlchina?hl=zh-CN。
> 要查看更多选项,请访问 https://groups.google.com/groups/opt_out。
>
>
>

-- 
您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
要退订此论坛并停止接收此论坛的电子邮件,请发送电子邮件到 [email protected]。
要向此网上论坛发帖,请发送电子邮件至 [email protected]。
通过以下网址访问此论坛:http://groups.google.com/group/perlchina?hl=zh-CN。
要查看更多选项,请访问 https://groups.google.com/groups/opt_out。


回复