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

Memory leak? #501

Open
TakuNishiumi opened this issue Dec 13, 2023 · 0 comments
Open

Memory leak? #501

TakuNishiumi opened this issue Dec 13, 2023 · 0 comments

Comments

@TakuNishiumi
Copy link

Hi,
I tried below code and usage rate of my memory increased up to around 10GB.

// 配列を宣言する
double[] array = new double[110];

// 乱数を生成する
Random rnd = new Random();

// 配列に乱数を代入する
// make random double array
for (int i = 0; i < array.Length; i++)
{
    array[i] = rnd.NextDouble();
}

// make new NDarray in loop
for (int i = 0; i < 1000000; i++)
{
    NDArray array2 = np.array(array);
    // NDArray array2 = np.argmin(array); also cause same trouble
}

This is also caused when this is used as function.
I modified this and add GC.Collect().
This make the code usage rate of my memory, but the calculation time increased.

// 配列を宣言する
double[] array = new double[110];

// 乱数を生成する
Random rnd = new Random();

// 配列に乱数を代入する
// make random double array
for (int i = 0; i < array.Length; i++)
{
    array[i] = rnd.NextDouble();
}

// make new NDarray in loop
for (int i = 0; i < 1000000; i++)
{
    NDArray array2 = np.array(array);
    if (i % 10000 == 0)
    {
        GC.Collect();
    }
}

What should I do next?
Do you have any ideas?

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