Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

High memory usage in 7.0.0 #205

Open
ahmedmansour-geotab opened this issue Sep 27, 2024 · 0 comments
Open

High memory usage in 7.0.0 #205

ahmedmansour-geotab opened this issue Sep 27, 2024 · 0 comments

Comments

@ahmedmansour-geotab
Copy link

ahmedmansour-geotab commented Sep 27, 2024

NodeJs: v20.17.0
dotnet: 8
Issue: The newest nuget v7.0.0 shows an extremely high memory usage for NodeJs compared to v6.3.1. We ran a stress test on the system and v7.0.0 shows usage 10x the amount v6.3.1 shows.
Expected behaviour: Memory usage should stay the same
Actual behaviour: Memory usage is too high and it blocks us from upgrading to the newest version.

To reproduce the issue, you can run the following snippet against both versions and compare the memory output:

using System.Diagnostics;
using Jering.Javascript.NodeJS;

for (int i = 0; i < 50; i++)
{
    string javascriptModule = @"
module.exports = (callback, x, y) => {  // Module must export a function that takes a callback as its first parameter
    var result = x + y; // Your javascript logic
    callback(null /* If an error occurred, provide an error object or message */, result); // Call the callback when you're done.
}";
    _ = await StaticNodeJSService.InvokeFromStringAsync<int>(javascriptModule, args: new object[] { 3, 5 });
}

Process proc = Process.GetCurrentProcess();
Console.WriteLine("memory = " + proc.PrivateMemorySize64);

Obviously this is a simple repro that doesn't show a 10x increase but it should show a consistently higher value when using 7.0.0 vs 6.3.1

When I run it I get
v7.0.0: 159428608
v6.3.1: 133042176

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant