Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: GPU VRAM is full even after program exit (yes you read it right)  (Read 1841 times)

0 Members and 1 Guest are viewing this topic.

Yatima1460

  • Newbie
  • *
  • Posts: 1
    • View Profile
    • Email
Hello SFML community!
My first post will be a good read for you, enjoy the madness

I am using SFML-2.4.2 64-bit (the static library, I'm not building it) with C++11 on Windows 10 64bit with Visual Studio 2017 with a Zotac 980Ti with the latest 384.76 drivers.

My problem is very simple:

When I close the application or it crashes the SFML allocated textures sometimes don't get removed from the GPU

I didn't believe it in the beginning but this is what happened:

In the beginning I miscalculated how much GPU VRAM I used and ended up using more than my VRAM (6GB) so the GPU started using the RAM as swap and obviously I had low FPS.
Nothing strange here, but the weirdness started when suddenly I got 1 FPS without any reason, I started to check my code for errors but didn't found anything, then I decided to run an empty project with only a window and a glClear and I still got 1FPS.

I restarted my computer and the empty project got 60 FPS again;

So I waited until this strange bug reappeared, it did, and the first thing I did was to restart manually the GPU driver on Windows (Disable and Enable on Device Manager), still 1 FPS, then I decided to reinstall the driver, still 1 FPS, the only solution to fix it is to completely reboot the system.

Another funny thing: WebGL on my browser crashed after a while, probably because VRAM almost got depleted?

I'm truly shocked, this is probably an obscure deep OpenGL, Windows, NVIDIA or even Hardware bug.

The only possible reason this could be related to SFML is that it creates some textures shared between contexts and then Windows for whatever reason loses the second context handler.

I don't even know how to debug, an empty SFML window gets 1 FPS after some hours of starting & closing my project multiple times and allocating a lot of textures.

Technically it shouldn't be my fault, I am simply creating textures on only one thread, and Windows should delete all the OpenGL contexts by default.

EDIT: It happens about once a day after starting and closing the application about 10-20 times

EDIT 2: another hypothesis a person suggested is that it could be Visual Studio 2017's fault for not clearing the OpenGL context

EDIT 3: it happens if I don't surpass the 6GB VRAM limit too, even when my application uses about 2GB of VRAM and I start and close it multiple times in the long run the VRAM will get depleted.

EDIT 4: If I start a game after the bug appears the game will get 1 FPS too.

EDIT 5: After the bug appears any application that uses the GPU gets 1 FPS.

I can't even use a drawing application like Paint.NET

What do you think?

What I think is:

(click to show/hide)
« Last Edit: July 06, 2017, 05:02:59 am by Yatima1460 »

Rocker54

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: GPU VRAM is full even after program exit (yes you read it right)
« Reply #1 on: July 07, 2017, 08:18:49 pm »
Would you post the code for us?

Flaze07

  • Jr. Member
  • **
  • Posts: 64
    • View Profile
    • Email
Re: GPU VRAM is full even after program exit (yes you read it right)
« Reply #2 on: July 09, 2017, 04:29:23 am »
then have you rewritten the code ?
if the problem is solved after rewritting the whole code then the whole world will be happy  ;D