How to reduce phantomjs memory consumption?

◇◆丶佛笑我妖孽 提交于 2019-12-03 09:11:13

问题


I'm using phantomjs with casperjs to run multiple tests and it looks like each instance of PhantomJS takes ~106M of RAM. Is it possible to reduce that amount? Is there a simple way to run tests in multiple "tabs"?


回答1:


Edit: As pointed by @newfurniturey, release is now deprecated. We must use close: http://phantomjs.org/api/webpage/method/close.html

Don't know if that helps, but the release function could be a good tail : http://phantomjs.org/api/webpage/method/release.html

Releases memory heap associated with this page. Do not use the page instance after calling this.

Due to some technical limitation, the web page object might not be completely garbage collected. This is often encountered when the same object is used over and over again. Calling this function may stop the increasing heap allocation.

:)



来源:https://stackoverflow.com/questions/8647980/how-to-reduce-phantomjs-memory-consumption

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!