5

Maybe someone enlighten me. I got this piece of code:

import pygame
from OpenGL.GL import glClear, GL_COLOR_BUFFER_BIT, GL_DEPTH_BUFFER_BIT, GL_STENCIL_BUFFER_BIT
from pygame.constants import DOUBLEBUF, OPENGL

pygame.init()
clock = pygame.time.Clock()
pygame.display.set_mode((640,480), DOUBLEBUF|OPENGL)

    
while 1:
    glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT)


    pygame.display.flip()
    clock.tick(50)

Running this causes slow but annoying memory consumption when I check it with process manager. Why is this happening? Not really creating any new object... Just clearing GL buffer and flipping window buffers. I narrowed this down to pygame.display.flip() call but cant do anything about it.

Rabbid76
  • 202,892
  • 27
  • 131
  • 174
R3qUi3M
  • 65
  • 4
  • 2
    At first glance, it looks like `SDL_GL_SwapWindow` may be the culprit. – Passerby Jan 03 '22 at 23:38
  • 1
    I cannot reproduce the problem. This seems to be system dependent. What is your system? – Rabbid76 Jan 04 '22 at 07:57
  • @Rabbid76 I'm using windows 7 Home Premium. On the other hand I also noticed that the memory consumption stops creeping up after some time. For example with large background image and whole program loaded it starts at 159300K and stops at 16004 K. Wierd... – R3qUi3M Jan 04 '22 at 12:31
  • 1
    @R3qUi3M This is not a problem with the code, it is with your system. Have you tried updating the graphics driver, pyopengl, and python yet? – Rabbid76 Jan 04 '22 at 12:52
  • @Rabbid76 Yeah. I got everything up to date as much as it can be for this PC. Maybe i should actually get new PC instead. Current hardware is dated from 2014 so kinda meh nowadays but works and I had no problem playing any modern game ans such. Strangely enough if I load multiple object VAOs into buffer, the memory leak is not an issue... Very bizarre behavior. – R3qUi3M Jan 06 '22 at 18:13

0 Answers0