Why are OpenGL and CUDA contexts a greedy memory?

I develop software that typically includes the OpenGL and Nvidia CUDA SDKs. Recently, I also started looking for ways to optimize runtime during work. I noticed the following (Debug and Release builds differ only 4-7 MB):

Application launch - less than 1 Mb in total

Creating OpenGL 4.5 context (+ GLEW bootloader initializer) - 45 MB total

CUDA 8.0 Context (API Driver) 114 MB .

If I create an OpenGL context in headless mode, the GL context uses less than 3 MB, which probably refers to the default buffer allocation. This makes sense since the window size is 640x360.

Thus, after the OpenGL and CUDA contexts are up, the process already consumes 114 MB .

Now I don’t have deep knowledge about OS-specific materials that occur under the hood when creating the GL and CUDA context, but 45 MB for GL and 68 for CUDA seem a lot to me. I know that usually a few megabytes arrive in the system frame buffers, pointers to functions (most of the distributions probably come from the driver side). But defeating more than 100 MB using only “empty” contexts looks too much.

I'd like to know:

  • Why does creating GL / CUDA context consume such a significant amount of memory?

  • Are there any ways to optimize this?

: Windows 10 64bit. NVIDIA GTX 960 ( : 388.31). 8 . Visual Studio 2015, 64- ++.

Visual Studio → " ".

UPDATE

Process Explorer, datenwolf. , ( ):

enter image description here

. " " "VS Diagnostic Tools". "Working Set", "WS Private" .. , ? 281,320K , , , , CUDA OpenGL.

+4

Source: https://habr.com/ru/post/1689754/


All Articles