Skip to content

memory issue #612

Closed
Closed

Description

@ert55

I'm running my app in a low resource environment. After a few calls to JavaScriptObfuscator.obfuscate my nodejs app runs out of memory.
Each obfuscation increases the heap by ~10mb and never gets garbage collected.

var app = require('express')();
var JavaScriptObfuscator = require('javascript-obfuscator');
.....
app.use(async function (req, res, next) {
if (path.basename(req.url) == 'somefile.js') {
var file = fs.readFileSync('somefile.js', 'ascii');
var obfuscationResult = JavaScriptObfuscator.obfuscate(file, {
compact: true,
controlFlowFlattening: true,
controlFlowFlatteningThreshold: 0.75,
deadCodeInjection: true,
deadCodeInjectionThreshold: 0.4,
debugProtection: false,
debugProtectionInterval: false,
disableConsoleOutput: true,
identifierNamesGenerator: 'mangled',
log: false,
renameGlobals: false,
rotateStringArray: true,
selfDefending: true,
shuffleStringArray: true,
splitStrings: true,
splitStringsChunkLength: 2,
stringArray: true,
stringArrayEncoding: 'base64',
stringArrayThreshold: 0.75,
transformObjectKeys: true,
unicodeEscapeSequence: false
});
res.end(obfuscationResult.getObfuscatedCode());
}
next();
}

Activity

  1. sanex3339 commented on May 29, 2020

    @sanex3339
    Member

    Hmm. Looks like a memory leak in this option
    identifierNamesGenerator: 'mangled'

  2. sanex3339 commented on May 29, 2020

    @sanex3339
    Member

    PR
    #614

    Can you try this branch?

  3. sanex3339 commented on May 29, 2020

    @sanex3339
    Member

    Tested it with 200mb memory limit. Now it works fine!

  4. sanex3339 commented on May 29, 2020

    @sanex3339
    Member

    Released as 0.28.3.
    Let me know if it fixed your problem.

  5. ert55 commented on May 31, 2020

    @ert55
    Author

    Looks like it solved the problem. Thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions