Исходники и презентации

This commit is contained in:
2025-05-23 07:26:39 +03:00
parent aa948179d5
commit 02d8430a3a
514 changed files with 13773 additions and 0 deletions

View File

@ -0,0 +1,34 @@
package main
import (
"fmt"
"runtime"
"time"
)
type Foo struct {
bar *Bar
}
type Bar struct {
foo *Foo
}
func main() {
foo := &Foo{}
bar := &Bar{}
foo.bar = bar
bar.foo = foo
runtime.SetFinalizer(foo, func(ptr *Foo) {
fmt.Println("finalizer called on addr", ptr, "value is", *ptr)
})
runtime.SetFinalizer(bar, func(ptr *Bar) {
fmt.Println("finalizer called on addr", ptr, "value is", *ptr)
})
runtime.GC()
time.Sleep(10 * time.Second)
}