wailsapp/wails · error
GlobalFree failed
Error message
GlobalFree failed
What it means
Error "GlobalFree failed" thrown in wailsapp/wails.
Source
Thrown at v3/pkg/w32/kernel32.go:135
}
func GlobalAlloc(uFlags uint, dwBytes uint32) HGLOBAL {
ret, _, _ := procGlobalAlloc.Call(
uintptr(uFlags),
uintptr(dwBytes))
if ret == 0 {
panic("GlobalAlloc failed")
}
return HGLOBAL(ret)
}
func GlobalFree(hMem HGLOBAL) {
ret, _, _ := procGlobalFree.Call(uintptr(hMem))
if ret != 0 {
panic("GlobalFree failed")
}
}
func GlobalLock(hMem HGLOBAL) unsafe.Pointer {
ret, _, _ := procGlobalLock.Call(uintptr(hMem))
if ret == 0 {
panic("GlobalLock failed")
}
return unsafe.Pointer(ret)
}
func GlobalUnlock(hMem HGLOBAL) bool {
ret, _, _ := procGlobalUnlock.Call(uintptr(hMem))
return ret != 0
}View on GitHub (pinned to 0e754b1b40)
Solutions
- Only free a handle returned by GlobalAlloc; freeing an invalid, already-freed, or locked memory handle makes GlobalFree fail.
- Unlock the memory with GlobalUnlock before freeing it if it is still locked.
- Set the handle to zero after freeing and do not use it again to avoid double-free failures.
When it happens
Trigger: Occurs when GlobalFree returns non-NULL, indicating the memory handle is invalid or the memory has already been freed.
Common situations: See trigger scenarios.
AI-assisted analysis of wailsapp/wails@0e754b1b40 (2026-08-15).
Data as JSON: /api/errors/f1a31f6190ac986b.
Report an issue: GitHub.