Skip to content

Memory leak? #501

Open
Open
@TakuNishiumi

Description

@TakuNishiumi

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions