如何减少phantomjs内存消耗? [英] How to reduce phantomjs memory consumption?

查看:3695
本文介绍了如何减少phantomjs内存消耗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用phantomjs与casperjs运行多个测试,它看起来像PhantomJS的每个实例大约需要的RAM 106M。是有可能减少量?有没有一种简单的方法来运行多个标签测试?

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"?

推荐答案

编辑:作为指向的@newfurniturey,的发布的现在是很precated。我们必须使用的关闭的:
http://phantomjs.org/api/webpage/method/close.html

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

不知道有没有什么帮助,但是的发布的功能,可以很好的尾巴:
http://phantomjs.org/api/webpage/method/release.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.

:)

这篇关于如何减少phantomjs内存消耗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆