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

Memory leak while moving the mouse #2999

Open
OlaKenji opened this issue Jul 16, 2024 · 4 comments
Open

Memory leak while moving the mouse #2999

OlaKenji opened this issue Jul 16, 2024 · 4 comments
Labels
bug Not working as intended macOS

Comments

@OlaKenji
Copy link

OlaKenji commented Jul 16, 2024

Current behavior:

I notised that by monitoring my activity monitor, the memory keeps increasing if I just move the mouse (track pad). I also confirmed that the memory increases by using the psutil module. Below is a code I used. If I keep moving the mouse, the printed value keeps increasing.

Test code

import pygame
import sys
import psutil
process = psutil.Process()

pygame.init()

window_size = (800, 600)
screen = pygame.display.set_mode(window_size)

running = True
while running:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False

    screen.fill((255, 255, 255))
    
    print(process.memory_info().rss/1000000)  

    pygame.display.update()

pygame.quit()
sys.exit()

Environment:

pygame-ce 2.2.0 (SDL 2.0.22, Python 3.9.12)
Platform:		macOS-10.16-x86_64-i386-64bit
System:			Darwin
System Version:		Darwin Kernel Version 21.4.0: Fri Mar 18 00:46:32 PDT 2022; root:xnu-8020.101.4~15/RELEASE_ARM64_T6000
Processor:		i386
Architecture:		Bits: 64bit	Linkage: 
Driver:			cocoa

Python:			CPython
pygame version:		2.2.0
python version:		3.9.12

SDL versions:		Linked: 2.0.22	Compiled: 2.0.22
SDL Mixer versions:	Linked: 2.6.2	Compiled: 2.6.2
SDL Font versions:	Linked: 2.20.1	Compiled: 2.20.1
SDL Image versions:	Linked: 2.0.5	Compiled: 2.0.5
Freetype versions:	Linked: 2.12.1	Compiled: 2.12.1
None
@OlaKenji OlaKenji added the bug Not working as intended label Jul 16, 2024
@damusss
Copy link
Contributor

damusss commented Jul 16, 2024

Hi, with the latest version pygame-ce, python and windows 11 I can't reproduce the issue, my memory is pretty stable with rare small changes, maybe someone else can reproduce it.
Just in case, I suggest updating your pygame-ce version (latest is 2.5.0) to check if it's already fixed, or maybe even upgrade your python version.

@gresm
Copy link
Contributor

gresm commented Jul 25, 2024

Same here, can't reproduce this with latest pygame-ce, ubunut 22. Please check if this issue persists after upgrading pygame-ce (pip install --upgrade pygame-ce).

@rethanon
Copy link
Contributor

rethanon commented Aug 3, 2024

I just replicated this issue on a Mac so it is a valid bug. For the record I also tested on Windows 11 and could not replicate it, so perhaps this is specific to Mac.

System: Intel MacBook Pro (2015) running macOS Monterey version 12.7.5
Python version: 3.12.4
Pygame version: pygame-ce 2.5.0

The output started at 81.4 and after running it for a while and moving the mouse it was at 84.6. Oh and to clarify I was using a trackpad too, not sure if it would be any different using a physical mouse.

@gresm gresm added the macOS label Aug 8, 2024
@gresm
Copy link
Contributor

gresm commented Aug 8, 2024

Marking it as macOS specific.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Not working as intended macOS
Projects
None yet
Development

No branches or pull requests

4 participants