deepakkumar1984 / Amplifier.NET

Amplifier allows .NET developers to easily run complex applications with intensive mathematical computation on Intel CPU/GPU, NVIDIA, AMD without writing any additional C kernel code. Write your function in .NET and Amplifier will take care of running it on your favorite hardware.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OutOfMemory

Yoticc opened this issue · comments

commented

I wrote a program that calculates 1875000 int on CPU/GPU with your library every second, I pass this via [GLOBAL].
You forgot to add Free for GCHandle somewhere, which causes the memory to overflow, after 20 minutes and 10GB of used memory, the program crashes due to OutOfMemory
image
image
image

commented

If you need my code:
image
Kernel:
image

commented

Hello, how are you?

commented

How are things with this error?

@MrYotic Can you please send your code in a file? I am making mistakes with your code. It will be easy if you send me in a file

commented

Good, https://dropmefiles.com/TCBa9 - Net 6.0
Calculate is part with GPU Calculating

commented

I was able to solve this problem, the memory leak is completely gone.
For the most part, it was not in your library, but in my code. So, every iteration I created a new big array, but because somewhere in your code there was a reference to this array, the GC could not clear it, so a bunch of large ones accumulated array. I think this can be solved through the library, so that other people do not have such an error in the future.
As exapmple bad code with memory leak:

while(true)
{
    int[] args = new int[1750000];
    kernel.Exec(args);
}

As exapmple bad code without memory leak:

int[] args;
while(true)
{
    args = new int[1750000];
    kernel.Exec(args);
}