• Russ Cox's avatar
    runtime: update docs, code for SetFinalizer · 9a5b055b
    Russ Cox authored
    At last minute before 1.3 we relaxed SetFinalizer to avoid
    crashes when you pass the result of a global alloc to it.
    This avoids the crash but makes SetFinalizer a bit too relaxed.
    
    Document that the finalizer of a global allocation may not run.
    
    Tighten the SetFinalizer check to ignore a global allocation but
    not ignore everything else.
    
    Fixes #7656.
    
    LGTM=r, iant
    R=golang-codereviews, iant, r
    CC=dvyukov, golang-codereviews, khr, rlh
    https://golang.org/cl/145930043
    9a5b055b
malloc.go 23.4 KB