Skip to content

Memory Leak in node-tar Library caused by normalize-unicode #432

Open
@debianr3

Description

Description

We have identified a memory leak in our application that is caused by the node-tar library.
The issue is related to the normalize-unicode.ts file specifically around line 5. Here is the link to the relevant code:

https://github.com/isaacs/node-tar/blob/main/src/normalize-unicode.ts#L5

There is a global cache causing the issue. My suggestion, if we really need a cache there, to improve performance and reduce memory usage, the cache should be implemented as a Least Recently Used (LRU) or be scoped to the current execution context.

Steps to Reproduce:

Integrate the node-tar library into your project.
Use the normalize-unicode function in a high-frequency loop with large data sets.
Monitor the memory usage of the application over time.
Expected Behavior: The memory usage should remain stable and not increase significantly over time.

Actual Behavior: The memory usage increases continuously, leading to a memory leak.

Environment:

node-tar version: latest
Node.js version: node 22
Operating System: linux

Activity

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

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions