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

OutOfMemory #20

Open
Yoticc opened this issue Jul 8, 2022 · 8 comments
Open

OutOfMemory #20

Yoticc opened this issue Jul 8, 2022 · 8 comments

Comments

@Yoticc
Copy link

Yoticc commented Jul 8, 2022

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

@Yoticc
Copy link
Author

Yoticc commented Jul 8, 2022

If you need my code:
image
Kernel:
image

@deepakkumar1984
Copy link
Owner

deepakkumar1984 commented Jul 9, 2022 via email

@Yoticc
Copy link
Author

Yoticc commented Jul 29, 2022

Hello, how are you?

@Yoticc
Copy link
Author

Yoticc commented Aug 6, 2022

How are things with this error?

@deepakkumar1984
Copy link
Owner

@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

@Yoticc
Copy link
Author

Yoticc commented Aug 16, 2022

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

@Yoticc
Copy link
Author

Yoticc commented Aug 16, 2022

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);
}

@deepakkumar1984
Copy link
Owner

deepakkumar1984 commented Aug 16, 2022 via email

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

2 participants