QB64Team / qb64

BASIC for the modern era.
https://www.qb64.org
Other
672 stars 96 forks source link

QB64 slows down to a crawl after a while at random. #208

Open RealKindOne opened 3 years ago

RealKindOne commented 3 years ago

Windows 7 SP1

QB v2.1 c48bf6776ec83adc030f55b2ade78e146aada62e

Describe the bug

QB64's UI will stall when doing other things. Keyboard shortcuts and using the mouse are delayed. It takes about 30 seconds to do something. Eventually the stalling will stop, but that can take 30+ minutes?

To Reproduce Reproducing is a bit difficult and might take a while.

  1. Open QB64
  2. Open a video game (Factorio for me)
  3. Wait an hour or so?
  4. Switch back to QB64.
  5. The UI is slow.

Expected behavior

Don't stall.

Additional context

U:\Earth\ashish.exe on Discord has also talked about this issue. (October 21, 2021)

I've built a debug build and I've profiled it in "Very Sleepy" twice.

https://github.com/VerySleepy/verysleepy

http://www.codersnotes.com/sleepy/

sleepy.zip

Open the files and click "SleepEx" at the top.

According to Very Sleepy (capture-2021-10-27.sleepy), it was doing this:

internal/c/qbx.cpp:

32.90% line 1967: if (stop_program){exit_ok|=2; return;}//close thread #2

internal/c/libqb.cpp:

27.70% line 12930: evnt(0);//check for new events 26.58% line 28030:vertical_retrace_happened=1; vertical_retrace_in_progress=1; 6.32% line 26868: Sleep(4); msdelay-=4;//this forces GLUT to relinquish some CPU time to other threads but still allow for _FPS 100+ 4.14% line 12935: goto recalculate; 2.36% line 28033: if (close_program){

FellippeHeitor commented 3 years ago

That's very detailed and the "Very Sleepy" report should help very much. Thank you for your report. If you come up with anything else, please let us know.