我使用 phantomjs 和 casperjs 来运行多个测试,看起来 PhantomJS 的每个实例都需要大约 106M 的 RAM。有没有可能减少这个数额?有没有一种简单的方法可以在多个“选项卡”中运行测试?
最佳答案
编辑:正如@newfurniturey 所指出的,release 现在已被弃用。我们必须使用关闭:
http://phantomjs.org/api/webpage/method/close.html
不知道这是否有帮助,但释放功能可能是一个很好的尾部:
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.
:)
关于webkit - 如何减少phantomjs内存消耗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8647980/