# GL_OUT_OF_MEMORY Error when glDispatchCompute takes longer

I built a simple Ray Tracer which takes use of OpenGL's Compute Shader and traces ".obj" Files. The results are passed to the Host-Program via glMapBufferRange after finishing computing. From there I will output the result as png to validate the result... When I change the dimensions for the output the computation will obviously take longer.

## Now to the problem/question:

Let's say the computation works fine with a 300x300 .png image file and I get the result I want. When I increase the size of the image to something like 500x500 I'll get a GL_OUT_OF_MEMORY Error after some time. And only when I try to copy data with glMapBufferRange.

When I'm using a BVH-Structure to accelerate the computation it works with 500x500 and larger images within a shorter time period.

So I think that the Operating System is shutting down the GPU after some time and thus resulting into a invalid Memory Access. Not sure though.

I've been using Ubuntu 20.04 for the program.

Can someone explain why I get an GL_OUT_OF_MEMORY? Is it more likly that I just have some Memory Leaks?

the probably critical part of the Code:

/* Some ssbo's and glsl-program defined above */
glDispatchCompute(workgroup_x, workgroup_y, 1);