Selaa lähdekoodia

Try to GC on each facemorph

denikson 6 vuotta sitten
vanhempi
commit
00fbf1d71f
2 muutettua tiedostoa jossa 4 lisäystä ja 0 poistoa
  1. 2 0
      commands/facemorph.js
  2. 2 0
      main.js

+ 2 - 0
commands/facemorph.js

@@ -166,6 +166,8 @@ async function processFaceSwap(message, attachmentUrl, processor, failMessage, s
     message.channel.send(messageContents, {
         files: [buffer]
     });
+
+    global.gc();
 }
 
 const onMessage = (msg, contents, actionsDone) => {

+ 2 - 0
main.js

@@ -3,6 +3,8 @@ const fs = require("fs");
 const path = require("path");
 const client = require("./client.js");
 const util = require("./util.js");
+require("v8").setFlagsFromString("--expose_gc");
+global.gc = require("vm").runInNewContext("gc");
 
 const REACT_PROBABILITY = 0.6;