How to reduce phantomjs memory consumption?

后端 未结 1 1028
不思量自难忘°
不思量自难忘° 2021-02-04 08:41

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

1条回答
  •  北荒
    北荒 (楼主)
    2021-02-04 09:20

    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.

    :)

    0 讨论(0)
提交回复
热议问题