From af47604cc3af028a764afb48ca4872b9a1062b82 Mon Sep 17 00:00:00 2001 From: ziggie Date: Tue, 3 Jun 2025 17:28:40 +0200 Subject: [PATCH] fn: add comment to context create fn --- fn/context_guard.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fn/context_guard.go b/fn/context_guard.go index 94b2d8ee8..7d21bce35 100644 --- a/fn/context_guard.go +++ b/fn/context_guard.go @@ -127,6 +127,10 @@ func WithTimeoutCG() ContextGuardOption { // Create is used to derive a cancellable context from the parent. Various // options can be provided to configure the behaviour of the derived context. +// +// NOTE: When creating a new context make sure that either the global context +// is quit or the returned cancel function is called to remove the cancel +// function form the internal map of the context guard so avoid a memory leak. func (g *ContextGuard) Create(ctx context.Context, options ...ContextGuardOption) (context.Context, context.CancelFunc) {