Closed seanlinsley closed 8 years ago
Welp this is terrible. I'll take your word for it.
Landed in 0.12.5
Yeah it's pretty terrible, and took a long time to isolate. Even better, Circle CI has some weird configuration where this change doesn't help. Or perhaps it's a problem unique to Ubuntu: #13805.
Thanks for merging this! It at least makes it possible for us to run our tests locally 😅
I am using phantomjs as a crawler middleware, I want to clear cache after every page.open complete, and google lead me to here.
I wonder why here set setInterval(page.clearMemoryCache, 500)
on every page.open
.
Upon further investigation is it actually the assignment of phantom.onError
that causes the memory leak. Simply removing that line, the tests run as expected. (Alternatively, having javascript that never throws errors also works.)
To try to help fix the bug, I need to know more about why that line is there in the first place.
Heh, I was going to ask you why that line was there.
I have no recollection at all off-hand, and a few minutes of blaming led me to this commit by @wireframe https://github.com/searls/jasmine-rails/commit/39459c0a3a2946ae6ad8c74af7ad4984695526b3
Well, I don't know much yet, but the implementation here is almost verbatim from the example on phantomjs.org
Ugh. I'm not very close to this. Does anyone want to chime in on what they think we should do?
http://stackoverflow.com/questions/24436460 https://github.com/ariya/phantomjs/issues/10357 https://github.com/ariya/phantomjs/commit/5768b705a0
Without this change, PhantomJS 2 consumes all available memory (at least 8 GB) with our test suite.