MCPcopy Create free account
hub / github.com/buke/quickjs-go / Delete

Method Delete

handle.go:64–78  ·  view source on GitHub ↗

Delete deletes handle by ID and properly releases cgo.Handle

(id int32)

Source from the content-addressed store, hash-verified

62
63// Delete deletes handle by ID and properly releases cgo.Handle
64func (hs *handleStore) Delete(id int32) bool {
65 if hs == nil || id <= 0 {
66 return false
67 }
68
69 if value, ok := hs.handles.LoadAndDelete(id); ok {
70 handle, ok := value.(cgo.Handle)
71 if !ok {
72 return false
73 }
74 handle.Delete() // critical: release cgo.Handle to prevent memory leak
75 return true
76 }
77 return false
78}
79
80// Clear clears all handles (called on Context.Close)
81func (hs *handleStore) Clear() {

Callers 3

LoadMethod · 0.45
ClearMethod · 0.45

Calls

no outgoing calls