Skip to content

runtime: runtime.SetFinalizer: pointer not at beginning of allocated block #7656

@emidoots

Description

@emidoots
What does 'go version' print?
go version devel +ed3e89f781c1 Thu Mar 27 00:29:55 2014 -0400 linux/amd64

What steps reproduce the problem?
If possible, include a link to a program on play.golang.org.
1. (reproducable on playground and tip linux/amd64)
2. http://play.golang.org/p/o61E8TfkcV

What happened?
runtime.SetFinalizer: pointer not at beginning of allocated block
fatal error: runtime.SetFinalizer

goroutine 16 [running]:
runtime.throw(0x45cd03)
    /home/stephen/go/src/pkg/runtime/panic.c:520 +0x69 fp=0x7ff689f8ee98
runtime.SetFinalizer(0x423b80, 0x45eee0, 0x0, 0x0)
    /home/stephen/go/src/pkg/runtime/malloc.goc:936 +0x40 fp=0x7ff689f8ef18
main.main()
    /home/stephen/Desktop/godev/finalizer.go:12 +0x51 fp=0x7ff689f8ef50
runtime.main()
    /home/stephen/go/src/pkg/runtime/proc.c:243 +0x11a fp=0x7ff689f8efa8
runtime.goexit()
    /home/stephen/go/src/pkg/runtime/proc.c:1426 fp=0x7ff689f8efb0
created by _rt0_go
    /home/stephen/go/src/pkg/runtime/asm_amd64.s:97 +0x120

goroutine 17 [runnable]:
runtime.MHeap_Scavenger()
    /home/stephen/go/src/pkg/runtime/mheap.c:507
runtime.goexit()
    /home/stephen/go/src/pkg/runtime/proc.c:1426
exit status 2

What should have happened instead?
The finalizer should be set (or it should be documented that finalizers do not work with
pointers declared not in a function's scope).

Please provide any additional information below.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions