Кажется, я получаю сообщение об ошибке
ActivityManager: процесс nl.xxxx.yyyy (pid 21526) умер: fore TOP (2411,292) ActivityManager: setHasOverlayUi вызван неизвестным pid: 21526
когда я вызываю указанную функцию в цикле. Примерно в 200 звонках появляется ошибка. Не похоже, что это проблема синхронизации, потому что даже если я вызываю функцию через 3 секунды (после возвращения яда), она умирает примерно через 200 циклов. Я попытался поместить все переменные вне функции, установив переменные в null, но, похоже, ничего не помоглоЯ гуглил свои пальцы до костей, но ничего не вышло ... кто-нибудь понял, что мне нужно делать?
function testrun(f)
{
// initially called with f = 0
if(f > 500) return; // limit test to 500 cycles
console.log ("fire :"+ f); // show the cycle you're in
getMyThumb("/storage/emulated/0/DCIM/Screenshots/Screenshot_20190710-092009_ScanApp.jpg")
.then( thumb =>
{
console.log(thumb);
setTimeout(() =>
{
testrun(f+1);
}, 5000); // tried setting timeout from 100ms to 5 seconds per cycle... All bugg out at ca. 200 cycles
})
global.gc(); // testd with\ without garbage collection
}
global.getMyThumb = function name(filepath)
{
return new Promise((resolve, reject)=>
{
global.gc(); // tried with \ without garbage collection here
imageSource = imageSourceModule.fromFile(filepath);
try
{
var mutable = BitmapFactory.makeMutable(imageSource);
var ThumbBitmap = BitmapFactory.asBitmap(mutable).dispose((bmp) =>
{
var optisizestring = "25,25";
test = bmp.resize(optisizestring);
base64JPEG = test.toBase64(BitmapFactory.OutputFormat.JPEG, 75);
img = imageSource.fromBase64(base64JPEG);
resolve( "data:image/png;base64," + base64JPEG);
global.gc(); // tried with \ without garbage collection here
});
} catch(ex) { console.log("errds " + ex); resolve (null);}
});
}