Originally reported by: Maksym Planeta (Bitbucket: mplaneta, GitHub: mplaneta)
Hello,
I have a following snippet of code:
#!python
pygame.init()
import time
time.sleep(50)
When the scripts goes sleep, I observe high CPU utilization.
I tracked this down to sound system, and when I add pygame.mixer.quit() after init, script utilizes CPU as expected. I figured out that pygame creates a new process, which eats up all the CPU and the backtrace of this thread looks as follows (this is how I pointed problem to sound mixer):
(gdb) bt
#0 0x00007f297504554d in poll () at ../sysdeps/unix/syscall-template.S:84
#1 0x00007f295e16107e in ?? () from /usr/lib/x86_64-linux-gnu/libasound.so.2
#2 0x00007f295e165fb8 in ?? () from /usr/lib/x86_64-linux-gnu/libasound.so.2
#3 0x00007f295e1a60c8 in ?? () from /usr/lib/x86_64-linux-gnu/libasound.so.2
#4 0x00007f29748c9fc5 in ALSA_PlayAudio (this=0x5633de70d990) at ./src/audio/alsa/SDL_alsa_audio.c:321
#5 0x00007f297489ed90 in SDL_RunAudio (audiop=audiop@entry=0x5633de70d990) at ./src/audio/SDL_audio.c:215
#6 0x00007f29748a6f58 in SDL_RunThread (data=0x5633de686360) at ./src/thread/SDL_thread.c:204
#7 0x00007f29748e79d9 in RunThread (data=<optimized out>) at ./src/thread/pthread/SDL_systhread.c:47
#8 0x00007f2975e5a424 in start_thread (arg=0x7f295622e700) at pthread_create.c:333
#9 0x00007f297504e9bf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:105
Python version: 3.5.3
libasound2 version: 1.1.3-4 (Debian testing)
Originally reported by: Maksym Planeta (Bitbucket: mplaneta, GitHub: mplaneta)
Hello,
I have a following snippet of code:
When the scripts goes sleep, I observe high CPU utilization.
I tracked this down to sound system, and when I add pygame.mixer.quit() after init, script utilizes CPU as expected. I figured out that pygame creates a new process, which eats up all the CPU and the backtrace of this thread looks as follows (this is how I pointed problem to sound mixer):
Python version: 3.5.3
libasound2 version: 1.1.3-4 (Debian testing)