Skip to content

Long pause when debugging a program Raylib or SDL on Linux #3906

Open
@lilliemarck

Description

When stepping over, or setting a breakpoint after InitWindow the debugger pauses for about 15-30 seconds, depending on which computer I use. The dlv process consumes 5 GB of memory during the pause.

Same thing happens with programs written in SDL or when writing a simple Cgo binding to Raylib myself. Both these libraries and my code do the runtime.LockOSThread() thing.

The problem is partially fixed by debugging with Goland but only if I use the Flatpak install. With Goland Flatpak the debugger freezes the first run and then only occasionally. Unfortunately I can only run my SDL programs like this but Raylib, which defaults to using Wayland, doesn't work at all unless I switch to the .tar.gz istall. I had other issues with VS Code too so I am not surprised Flatpak is not suitable for development, except for it doesn't freeze as often...

I am guessing it has something to do with lots of shared libraries being loaded.

go version go1.23.4 linux/amd64
 
Delve Debugger
Version: 1.24.0
Build: $Id: 2d55e4d30150e3fc68e64357e21293d7920fc1f1 $

main.go

package main

import rl "github.com/gen2brain/raylib-go/raylib"

func main() {
	println("No problem on this line")

	rl.InitWindow(800, 450, "raylib [core] example - basic window")
	defer rl.CloseWindow()

	rl.SetTargetFPS(60)

	for !rl.WindowShouldClose() {
		rl.BeginDrawing()
		rl.ClearBackground(rl.RayWhite)
		rl.DrawText("Congrats! You created your first window!", 190, 200, 20, rl.LightGray)
		rl.EndDrawing()
	}
}

go.mod

module basic_window

go 1.23.4

require github.com/gen2brain/raylib-go/raylib v0.0.0-20250109172833-6dbba4f81a9b

require (
	github.com/ebitengine/purego v0.7.1 // indirect
	golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect
	golang.org/x/sys v0.20.0 // indirect
)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions