Skip to content

Memory growth issue about crypto module. #13917

@gentlejo

Description

@gentlejo

If I run cipher related function many times, I can see memory growth even though execute gc manually.
To be more specific, if I use cipher.final(), it causes memory growth.

Below is test code.

    var crypto = require('crypto');

    function testCipher() {
        var cipher = crypto.createCipheriv('aes-128-gcm', Buffer.from('1234567890123456'), Buffer.from('a1'));
        cipher.setAutoPadding(false);

        return Buffer.concat([cipher.update(Buffer.from('datas')), cipher.final()]);
    }

    for (var i = 0; i < 100000000; i++) {
        testCipher();

        if (i % 200000 === 0) {
            gc(true);
        }
    } 

Metadata

Metadata

Assignees

No one assigned

    Labels

    cryptoIssues and PRs related to the crypto subsystem.memoryIssues and PRs related to the memory management or memory footprint.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions