解决Appium报错CALL_AND_RETRY_LAST Allocation failed - process out of memory


报错信息如下:

==== JS stack trace =========================================

Security context: 000001F25EA37349 <JS Object>
    1: /* anonymous */ [C:\Program Files (x86)\Appium\node_modules\appium\node_m
odules\appium-adb\lib\logcat.js:90] [pc=0000020C9E3A4AE9] (this=00000006B49295D9
 <JS Object>,log=000001F25EAAFB19 <String[38]: I/Recovery.JniCrash(23748): JNI_O
nLoad>)
    2: arguments adaptor frame: 3->1
    6: /* anonymous */(aka /* anonymous */) [native v8natives.js:1210] [pc=00000
20C9C76E35F] (this=000001F25EA...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory

问题原因:appium取android日志,内存没有释放,一直在增涨。

解决办法:本地appium安装目录找到logcat.js文件,例如路径在C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\lib\logcat.js

打开文件,注释掉如下2行内容:

Logcat.prototype.onOutput = function (data, prefix) {
  if (!this.logcatStarted) {
    this.logcatStarted = true;
    if (!this.calledBack) {
      this.calledBack = true;
      this.onLogcatStart();
    }
  }
  data = data.trim();
  data = data.replace(/\r\n/g, "\n");
  var logs = data.split("\n");
  _.each(logs, function (log) {
    log = log.trim();
    if (log) {
      var logObj = {
        timestamp: Date.now()
      , level: 'ALL'
      , message: log
      };
      //this.logs.push(logObj);
      //this.logsSinceLastRequest.push(logObj);
      this.emit('log', logObj);
      var isTrace = /W\/Trace/.test(data);
      if (this.debug && (!isTrace || this.debugTrace)) {
        logger.debug('[LOGCAT' + prefix + '] ' + log);
      }
    }
  }.bind(this));
};

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM