Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reduce phantomjs memory consumption?

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

like image 231
Fluffy Avatar asked Dec 27 '11 18:12

Fluffy


1 Answers

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.

:)

like image 142
Pirhoo Avatar answered Sep 28 '22 04:09

Pirhoo