Open Arkdevnoder opened 4 years ago
A memory leak was detected at > 2 RPS. Here is the code for testing (I apologize for the design of the code, I added an excerpt for issuing an HTML dump):
const fs = require("fs"); const rp = require('request-promise'); async function vk_post(data){ var options = { method: 'POST', uri: "https://api.vk.com/method/messages.send?v=5.68", form: data, headers: { 'User-Agent': 'E-Bot-handler' }, json: true }; try { const data = await rp(options); return data; } catch(e) { return e; } } let data = { message: "Hello", peer_id: "281618690", access_token: "1rtp142231432twg2" } setInterval(async function(){ await vk_post(data); }); let x = 0; setInterval(function(){ console.log(process.memoryUsage()); x = x+10; load = process.memoryUsage().rss/100000; loadX = process.memoryUsage().heapTotal/100000; loadY = process.memoryUsage().heapUsed/100000; loadZ = process.memoryUsage().external/10000; fs.appendFileSync('/var/www/html/load2.html', '<div style="bottom: '+load+'px; left: '+x+'px; position: absolute; height: 10px; width: 10px; background: red;"></div>'+ '<div style="bottom: '+loadX+'px; left: '+x+'px; position: absolute; height: 10px; width: 10px; background: blue;"></div>'+ '<div style="bottom: '+loadY+'px; left: '+x+'px; position: absolute; height: 10px; width: 10px; background: green;"></div>'+ '<div style="bottom: '+loadZ+'px; left: '+x+'px; position: absolute; height: 10px; width: 10px; background: pink;"></div>' ); }, 300);
A memory leak was detected at > 2 RPS. Here is the code for testing (I apologize for the design of the code, I added an excerpt for issuing an HTML dump):