Skip to content

Commit

Permalink
Attempt some crude memory management.
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelBone committed Jul 20, 2018
1 parent d98fca9 commit eaa2179
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions scraper.js
Expand Up @@ -111,6 +111,16 @@ async function main() {

console.log("Examining image.");
let imageBuffer = await (new Promise((resolve, reject) => jimpImage.getBuffer(jimp.MIME_PNG, (error, buffer) => resolve(buffer))));

jimpImage = null;
operator = null;
image = null;
try {
global.gc();
} catch (ex) {
console.log("Garbage collection not possible.");
}

let result = await new Promise((resolve, reject) => {
console.log("Calling recognize.");
tesseract.recognize(imageBuffer).then(function(result) {
Expand Down

0 comments on commit eaa2179

Please sign in to comment.